-
Notifications
You must be signed in to change notification settings - Fork 166
Conversation
@burci, walk me through why this is necessary? It's been 9 months since I wrote that code so I can't say I'm fully informed about my decision making back then but looking at the code suggests that sometimes error() is called with null as its first argument? Is it that, sometimes, communication errors are passed in as -1 (line 206..) but we weren't handling that correctly in the error() method? If so, actually, I think I remember that needing to investigate that bug further when I noticed it months ago. Still, I'm wondering if we won't now have places that do pass in null? Should this be:
|
@shaneharter, the short answer is the switch auto typecast mechanism, and the foreach(array(null, 0, "", "0", "a") as $test){
switch($test){
case 0: echo "0"; break;
case null: echo "N"; break;
}
} The result will be The long answer: i am hit by a php bug: https://bugs.php.net/bug.php?id=61369 , so i got $error_code = null; in switch($error) {
case 0: // Success
case 4: // System Interrupt
case MSG_ENOMSG: // No message of desired type
// Ignored Errors
return true;
break; at https://github.com/shaneharter/PHP-Daemon/blob/master/Core/Worker/Via/SysV.php#L362 executed insted of case null:
// Almost certainly an issue with shared memory
$this->mediator->log("Shared Memory I/O Error at Address {$this->mediator->guid}.");
$this->mediator->count_error('corruption');
... https://github.com/shaneharter/PHP-Daemon/blob/master/Core/Worker/Via/SysV.php#L407 |
I consider myself pretty knowledgable of esoteric php issues. This is a new Will merge when I get back to my desk. On Monday, September 30, 2013, Peter Buri wrote:
|
@burci Now that I'm at my desk I had a chance to look at the PHP bug you linked. Actually, it's a bug I've encountered myself and is the original reason why I built the integrated debug console so I could step through both sides of the multi-process communication in way that wasn't possible with xdebug and see what the hell was going on. Also, the 2.1 version I just released (feature_abstract_ipc) was done conceptually to separate the concerns better and shrink down the monster v2.0 Anyway, wanted to give you some moral support with your bugs 👍 |
@burci Sorry for emailing you a hundred times :) But I can't merge this until we make a small change. Please update the PR when you get a chance to do so. The issue is that at L206 now you're overwriting any existing value in $error_code. There are useful non-null values returned from that in some cases. So lets just do a:
I'll go in at some point and get rid of all these "magic number" error codes and add some class constants to make this more self documenting. |
@shaneharter sorry i missed that msg_send can change the $error_code. Should I introduce a |
Yeah, the constant would be great. Name looks good to me. Thanks man, really appreciate your help!!! |
Done! |
Fixed switch error code casting bug
Thx! |
No description provided.