Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I solved the issue by setting keep_alive option to false

 $client = new SoapClient($wsdl_url, array('keep_alive'=>false));
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda