Socket error on long running warlock service #24

Closed
opened 2017-08-18 02:02:15 +00:00 by jamie · 11 comments
jamie commented 2017-08-18 02:02:15 +00:00 (Migrated from git.hazaar.io)

Product system started getting these errors:

Aug 18 12:01:07 lighthammer warlock: PHP Warning:  socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928
Aug 18 12:01:08 lighthammer warlock: PHP Warning:  socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928
Aug 18 12:01:09 lighthammer warlock: PHP Warning:  socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928
Aug 18 12:01:10 lighthammer warlock: PHP Warning:  socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928
Aug 18 12:01:11 lighthammer warlock: PHP Warning:  socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928

Must investigate.

Product system started getting these errors: ``` Aug 18 12:01:07 lighthammer warlock: PHP Warning: socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928 Aug 18 12:01:08 lighthammer warlock: PHP Warning: socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928 Aug 18 12:01:09 lighthammer warlock: PHP Warning: socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928 Aug 18 12:01:10 lighthammer warlock: PHP Warning: socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928 Aug 18 12:01:11 lighthammer warlock: PHP Warning: socket_close(): supplied resource is not a valid Socket resource in /usr/local/share/abe-web/ABE/vendor/hazaarlabs/hazaar-warlock/src/Server.php on line 928 ``` Must investigate.
jamie commented 2017-08-18 02:02:21 +00:00 (Migrated from git.hazaar.io)

added ~135 label

added ~135 label
jamie commented 2017-08-18 03:05:24 +00:00 (Migrated from git.hazaar.io)

I think this is happening when a service crashes. So then the service is never restarted because execution bombs out before it gets a chance to.

The error that caused the above was

Aug 18 12:52:45 lighthammer warlock: 2017-08-18 12:52:45 -    ERR - #0 on line 315 in file /usr/local/share/abe-web/ABE/application/models/APIR/Object.php
Aug 18 12:52:45 lighthammer warlock: ----------------------------------------
Aug 18 12:52:45 lighthammer warlock: Access to undeclared static property: Application\Model\APIR\Object::$saved
Aug 18 12:52:45 lighthammer warlock: ----------------------------------------
I think this is happening when a service crashes. So then the service is never restarted because execution bombs out before it gets a chance to. The error that caused the above was ``` Aug 18 12:52:45 lighthammer warlock: 2017-08-18 12:52:45 - ERR - #0 on line 315 in file /usr/local/share/abe-web/ABE/application/models/APIR/Object.php Aug 18 12:52:45 lighthammer warlock: ---------------------------------------- Aug 18 12:52:45 lighthammer warlock: Access to undeclared static property: Application\Model\APIR\Object::$saved Aug 18 12:52:45 lighthammer warlock: ---------------------------------------- ```
jamie commented 2017-08-18 06:49:08 +00:00 (Migrated from git.hazaar.io)

Tried adding the following test to an existing service and ran on Windows. Triggering the 'test' event caused the error and the service shutdown gracefully as expected.

    function init(){

        $this->subscribe('test', 'doTest');

    }

    public function doTest(){

        Application\Model\APIR\Object::$saved = array();

    }
Tried adding the following test to an existing service and ran on Windows. Triggering the 'test' event caused the error and the service shutdown gracefully as expected. ```php function init(){ $this->subscribe('test', 'doTest'); } public function doTest(){ Application\Model\APIR\Object::$saved = array(); } ```
jamie commented 2017-10-25 05:21:02 +00:00 (Migrated from git.hazaar.io)

Looks like the control channel is actually getting dropped. I have a client that is saying they are getting an error stating that "An error occured while sending to the socket". Sounds like the service is losing it's control channel socket connection and there is no mechanism in place currently to reconnect because I thought this would not be an issue.

I think we need to reassess the use of sockets here and see if there is a way we can use pipes. The PHP documentation on proc_open() states that STDIN/STDOUT/STDERR should all be supported on Windows. Testing.

Looks like the control channel is actually getting dropped. I have a client that is saying they are getting an error stating that "An error occured while sending to the socket". Sounds like the service is losing it's control channel socket connection and there is no mechanism in place currently to reconnect because I thought this would not be an issue. I think we need to reassess the use of sockets here and see if there is a way we can use pipes. The PHP documentation on ```proc_open()``` states that STDIN/STDOUT/STDERR should all be supported on Windows. Testing.
jamie commented 2017-10-25 05:21:18 +00:00 (Migrated from git.hazaar.io)
created branch [`24-socket-error-on-long-running-warlock-service`](https://git.hazaarlabs.com/hazaar/hazaar-warlock/compare/master...24-socket-error-on-long-running-warlock-service)
jamie commented 2017-10-25 05:21:24 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !7

mentioned in merge request !7
jamie commented 2018-07-12 01:21:41 +00:00 (Migrated from git.hazaar.io)

mentioned in issue #27

mentioned in issue #27
jamie commented 2018-07-12 01:25:45 +00:00 (Migrated from git.hazaar.io)

added ~136 label

added ~136 label
jamie commented 2018-07-12 01:25:53 +00:00 (Migrated from git.hazaar.io)

added ~163 label

added ~163 label
jamie commented 2018-08-07 23:54:29 +00:00 (Migrated from git.hazaar.io)

I think I have this sorted as per #30 and #31 and resolved in 57be24de41

I think I have this sorted as per #30 and #31 and resolved in 57be24de4120fee84b932ba86e48f1e646c75cec
jamie commented 2018-08-07 23:54:29 +00:00 (Migrated from git.hazaar.io)

closed

closed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/hazaar-warlock#24
No description provided.