Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Worker process performing SOAP calls generates endless CLOSE_WAIT file descriptors

I'm running a PHP queue worker process that processes jobs that in turn create SOAP clients and perform SOAP requests. I'll try to outline the pseudo-code as clearly as possible.

Jobs and parameters are saved to the database an get instantiated by the worker. In simplified form, the worker looks like this:

while(true) {
    $job = initiateFromDatabase($id);
    $job->handle()
}

For a certain job a SOAPClient is instantiated and a SOAP call is performed. Some results are saved to a database.

The problem is that the process will pretty soon hit the open file descriptor limit. After some inspection with lsof -a -p <worker_pid> there are hundreds of TCP descriptors hanging in CLOSE_WAIT.

I've done intensive research and my conclusion is that there is no way to explicitly close the SOAP connection (and underlying) socket.

The only way to clear the hundreds of CLOSE_WAIT descriptors is to just kill the worker process.

How can I make sure I can run the worker for larger periods of time and make the CLOSE_WAIT descriptors disappear after the SOAPClient instance is not used anymore?

Thanks in advance.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I solved the issue by setting keep_alive option to false

 $client = new SoapClient($wsdl_url, array('keep_alive'=>false));
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda