php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55841 stream_socket_accept() warnings
Submitted: 2011-10-04 09:33 UTC Modified: 2018-05-05 21:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: aco dot best at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aco dot best at gmail dot com
New email:
PHP Version: OS:

 

 [2011-10-04 09:33 UTC] aco dot best at gmail dot com
Description:
------------
Hello, i have websocket server written using php cli and libevent. It
has master - childs(forks) architecture. Аll forks listening to single
port, and trying to accept incomming connection by stream_socket_accept().
But only one fork will accept single connection others will get a
warning. To suppress this warning iam using @. But unfortunately
warning still goes into set_error_handler callback. Such kind of
warning, cause performance penalty in this case.
I can see a few way how it can be solved inside php:
1. by removing this warning
2. by adding forth argument to the function call, to place error inside it
3. by creating function like stream_last_error
4. or any other appropriate way
It would be nice, if it will be solved,
Thank you.
Best, regards
Ivan Shalganov


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-05 21:25 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-05-05 21:25 UTC] requinix@php.net
A bit late, but

No no no. Address the problem of multiple children listening, not the symptoms of unwanted warning messages!
Only the master should be listening on the main port, and it forks the child only after it accepts a new connection. If you want to keep a preforking architecture like you kinda have now then then you need a mutex to restrict listening access to one idle child.
http://www.fmc-modeling.org/category/projects/apache/amp/4_3Multitasking_server.html
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC