Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!