What is the difference between mongoose's error report: timed out and socket closed? Under what circumstances do they appear?

recently, an interface for reading data has been found to take too long to return in the production environment.
Project uses nodejs + mongodb
Development dependency:

   

questions such as title:

  1. what is the difference between: timed out and socket closed in the error report of mongoose?
  2. Under what circumstances does
  3. appear respectively?

my understanding is timed out is passive shutdown, the server does not respond and ignore you, socket closed is an active shutdown, the server directly refused. mongoose listening timedout and close (had_error) are all executed socket.end () just to distinguish the error type.

Menu