[Pharo-project] Bad behaviour at startup
Hello. I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it. What you think about it? Is it fixed already at pharo 2.0? Best regards Denis
Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode. So can you tell us a bit more what you are doing and when? Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
Ok, I will look at mails. In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately. I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456] 2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr>
Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
I am on Windows 7 2012/9/24 Denis Kudriashov <dionisiydk@gmail.com>
Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr>
Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
The behavior you are seeing is standard behavior for a headless image, are you running headless or not ? On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
Of course not. Image is just usual image, not headless. When it starts I see all my browsers and workspaces but then it closed with PharoDebug report. Evening I will try such scenario at latest pharo2.0 <http://lingvopro.abbyyonline.com/ru/Search/GlossaryItemExtraInfo?text=%d0%ba...> 2012/9/24 Sven Van Caekenberghe <sven@stfx.eu>
The behavior you are seeing is standard behavior for a headless image, are you running headless or not ?
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
On Mon, Sep 24, 2012 at 10:44 AM, Sven Van Caekenberghe <sven@stfx.eu>wrote:
The behavior you are seeing is standard behavior for a headless image, are you running headless or not ?
I think that if the problem comes from the startUp processing, this is the standard behavior whether it is headless or not. But I may be wrong.... Igor/Esteban? I remember discussing this....
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
-- Mariano http://marianopeck.wordpress.com
Hello. I try it for latest pharo2.0 one click. Same results. I am on Windows 7. First I register ZnServer at workspace: server := ZnServer on: 10025. server start. server register server isRunning & server isListening. Then save image. When I reopen image server is running. Now if I run other application at same port and try to open pharo It will closed with pharoDebug about anable to create socket. No chance to debug and fix it. I think it is very bad behaviour because it make impossible to run my image at different computers just because another application holds socket. There is one strange thing. When I open another ZnServer on another image both images works nice. "server isRunning & server isListening." returns true for both. And same happens if I doing it from one single image. It is possible to create two ZnServer's for same port. Only one accept requests from webbrowser for example. But when I closed it another ZnServer start accept requests. I think I just don't know something about sockets but it looks very strange to me. Best regards, Denis 2012/9/24 Mariano Martinez Peck <marianopeck@gmail.com>
On Mon, Sep 24, 2012 at 10:44 AM, Sven Van Caekenberghe <sven@stfx.eu>wrote:
The behavior you are seeing is standard behavior for a headless image, are you running headless or not ?
I think that if the problem comes from the startUp processing, this is the standard behavior whether it is headless or not. But I may be wrong.... Igor/Esteban? I remember discussing this....
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
-- Mariano http://marianopeck.wordpress.com
On 29 September 2012 14:39, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hello.
I try it for latest pharo2.0 one click. Same results. I am on Windows 7.
First I register ZnServer at workspace:
server := ZnServer on: 10025. server start. server register server isRunning & server isListening.
Then save image. When I reopen image server is running. Now if I run other application at same port and try to open pharo It will closed with pharoDebug about anable to create socket. No chance to debug and fix it.
I think it is very bad behaviour because it make impossible to run my image at different computers just because another application holds socket.
There is one strange thing. When I open another ZnServer on another image both images works nice. "server isRunning & server isListening." returns true for both. And same happens if I doing it from one single image. It is possible to create two ZnServer's for same port. Only one accept requests from webbrowser for example. But when I closed it another ZnServer start accept requests. I think I just don't know something about sockets but it looks very strange to me.
About sockets: only one process in system can listen for particular socket address. Others will fail if you try to bind to it. But there's a socket option "SO_REUSEADDR" which allows you to bind to same address, i don't remember, however what exactly mechanism happens when you doing this. About image startup: during image startup, if something bad happens, it should capture a postmortem error and show you it with debugger once startup finished. But this style of error catching is enabled only for a Process which executing actual startup, not for any other [forked] processes, of course. If any of such process (like ZnServer) getting control before startup phase finished and throws the unhandled exception there, it will quit to OS. This is what you actually observing, because ZnServer lacks any exception handler in its #listenLoop : ZnSingleThreadedServer>>start "Start me. I will start listening on my port for incoming HTTP connections. If I am running, I will first stop and thus effectively restart" self stop. self log info: [ 'Starting ', self serverProcessName ]. self class default = self ifTrue: [ self register ]. process := [ [ self listenLoop ] repeat ] forkAt: Processor highIOPriority named: self serverProcessName The way how to fix that: - put an exception handler , and handle all exceptions not letting ui manager default error handler to decide what to do for you. - defer initiating/rebinding socket connections untill a system will finish startup using Smalltalk addDeferredStartupAction: [ .... ] like following: ZnServer class >> startUp: resuming "Our system startUp hook: start all servers we manage" (resuming or: [ self alwaysRestart ]) ifTrue: [ Smalltalk addDeferredStartupAction: [ self managedServers do: [ :each | each start ] ] ] like that, if image runs headless, it will still quit to OS, since nobody handling the exception(s) when server cannot bind to specified port, while if you run image headful, it will open a debugger. -- Best regards, Igor Stasenko.
On 29 September 2012 18:54, Igor Stasenko <siguctua@gmail.com> wrote:
On 29 September 2012 14:39, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hello.
I try it for latest pharo2.0 one click. Same results. I am on Windows 7.
First I register ZnServer at workspace:
server := ZnServer on: 10025. server start. server register server isRunning & server isListening.
Then save image. When I reopen image server is running. Now if I run other application at same port and try to open pharo It will closed with pharoDebug about anable to create socket. No chance to debug and fix it.
I think it is very bad behaviour because it make impossible to run my image at different computers just because another application holds socket.
There is one strange thing. When I open another ZnServer on another image both images works nice. "server isRunning & server isListening." returns true for both. And same happens if I doing it from one single image. It is possible to create two ZnServer's for same port. Only one accept requests from webbrowser for example. But when I closed it another ZnServer start accept requests. I think I just don't know something about sockets but it looks very strange to me.
About sockets: only one process in system can listen for particular socket address. Others will fail if you try to bind to it. But there's a socket option "SO_REUSEADDR" which allows you to bind to same address, i don't remember, however what exactly mechanism happens when you doing this.
About image startup: during image startup, if something bad happens, it should capture a postmortem error and show you it with debugger once startup finished. But this style of error catching is enabled only for a Process which executing actual startup, not for any other [forked] processes, of course. If any of such process (like ZnServer) getting control before startup phase finished and throws the unhandled exception there, it will quit to OS. This is what you actually observing, because ZnServer lacks any exception handler in its #listenLoop :
ZnSingleThreadedServer>>start "Start me. I will start listening on my port for incoming HTTP connections. If I am running, I will first stop and thus effectively restart"
self stop. self log info: [ 'Starting ', self serverProcessName ]. self class default = self ifTrue: [ self register ]. process := [ [ self listenLoop ] repeat ] forkAt: Processor highIOPriority named: self serverProcessName
The way how to fix that:
- put an exception handler , and handle all exceptions not letting ui manager default error handler to decide what to do for you.
-- OR -- (but if you do both it won't hurt either ;)
- defer initiating/rebinding socket connections untill a system will finish startup using Smalltalk addDeferredStartupAction: [ .... ] like following:
ZnServer class >> startUp: resuming "Our system startUp hook: start all servers we manage"
(resuming or: [ self alwaysRestart ]) ifTrue: [ Smalltalk addDeferredStartupAction: [ self managedServers do: [ :each | each start ] ] ]
like that, if image runs headless, it will still quit to OS, since nobody handling the exception(s) when server cannot bind to specified port, while if you run image headful, it will open a debugger.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Igor, On 29 Sep 2012, at 18:54, Igor Stasenko <siguctua@gmail.com> wrote:
On 29 September 2012 14:39, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hello.
I try it for latest pharo2.0 one click. Same results. I am on Windows 7.
First I register ZnServer at workspace:
server := ZnServer on: 10025. server start. server register server isRunning & server isListening.
Then save image. When I reopen image server is running. Now if I run other application at same port and try to open pharo It will closed with pharoDebug about anable to create socket. No chance to debug and fix it.
I think it is very bad behaviour because it make impossible to run my image at different computers just because another application holds socket.
There is one strange thing. When I open another ZnServer on another image both images works nice. "server isRunning & server isListening." returns true for both. And same happens if I doing it from one single image. It is possible to create two ZnServer's for same port. Only one accept requests from webbrowser for example. But when I closed it another ZnServer start accept requests. I think I just don't know something about sockets but it looks very strange to me.
About sockets: only one process in system can listen for particular socket address. Others will fail if you try to bind to it. But there's a socket option "SO_REUSEADDR" which allows you to bind to same address, i don't remember, however what exactly mechanism happens when you doing this.
About image startup: during image startup, if something bad happens, it should capture a postmortem error and show you it with debugger once startup finished. But this style of error catching is enabled only for a Process which executing actual startup, not for any other [forked] processes, of course. If any of such process (like ZnServer) getting control before startup phase finished and throws the unhandled exception there, it will quit to OS. This is what you actually observing, because ZnServer lacks any exception handler in its #listenLoop :
Hmm, not really, it lacks error handling around the creation of the server socket, not further down in #listenLoop.
ZnSingleThreadedServer>>start "Start me. I will start listening on my port for incoming HTTP connections. If I am running, I will first stop and thus effectively restart"
self stop. self log info: [ 'Starting ', self serverProcessName ]. self class default = self ifTrue: [ self register ]. process := [ [ self listenLoop ] repeat ] forkAt: Processor highIOPriority named: self serverProcessName
The way how to fix that:
- put an exception handler , and handle all exceptions not letting ui manager default error handler to decide what to do for you.
I am not sure that is a good idea: the error has to be reported. no ? Else we get a silent failure.
- defer initiating/rebinding socket connections untill a system will finish startup using Smalltalk addDeferredStartupAction: [ .... ] like following:
ZnServer class >> startUp: resuming "Our system startUp hook: start all servers we manage"
(resuming or: [ self alwaysRestart ]) ifTrue: [ Smalltalk addDeferredStartupAction: [ self managedServers do: [ :each | each start ] ] ]
like that, if image runs headless, it will still quit to OS, since nobody handling the exception(s) when server cannot bind to specified port, while if you run image headful, it will open a debugger.
OK, I didn't know about deferred startup actions, that sounds like a good idea indeed. I'll try to add that. Thanks a lot for the input ! Sven
-- Best regards, Igor Stasenko.
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
On 29 September 2012 19:31, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Igor,
On 29 Sep 2012, at 18:54, Igor Stasenko <siguctua@gmail.com> wrote:
On 29 September 2012 14:39, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hello.
I try it for latest pharo2.0 one click. Same results. I am on Windows 7.
First I register ZnServer at workspace:
server := ZnServer on: 10025. server start. server register server isRunning & server isListening.
Then save image. When I reopen image server is running. Now if I run other application at same port and try to open pharo It will closed with pharoDebug about anable to create socket. No chance to debug and fix it.
I think it is very bad behaviour because it make impossible to run my image at different computers just because another application holds socket.
There is one strange thing. When I open another ZnServer on another image both images works nice. "server isRunning & server isListening." returns true for both. And same happens if I doing it from one single image. It is possible to create two ZnServer's for same port. Only one accept requests from webbrowser for example. But when I closed it another ZnServer start accept requests. I think I just don't know something about sockets but it looks very strange to me.
About sockets: only one process in system can listen for particular socket address. Others will fail if you try to bind to it. But there's a socket option "SO_REUSEADDR" which allows you to bind to same address, i don't remember, however what exactly mechanism happens when you doing this.
About image startup: during image startup, if something bad happens, it should capture a postmortem error and show you it with debugger once startup finished. But this style of error catching is enabled only for a Process which executing actual startup, not for any other [forked] processes, of course. If any of such process (like ZnServer) getting control before startup phase finished and throws the unhandled exception there, it will quit to OS. This is what you actually observing, because ZnServer lacks any exception handler in its #listenLoop :
Hmm, not really, it lacks error handling around the creation of the server socket, not further down in #listenLoop.
ZnSingleThreadedServer>>start "Start me. I will start listening on my port for incoming HTTP connections. If I am running, I will first stop and thus effectively restart"
self stop. self log info: [ 'Starting ', self serverProcessName ]. self class default = self ifTrue: [ self register ]. process := [ [ self listenLoop ] repeat ] forkAt: Processor highIOPriority named: self serverProcessName
The way how to fix that:
- put an exception handler , and handle all exceptions not letting ui manager default error handler to decide what to do for you.
I am not sure that is a good idea: the error has to be reported. no ? Else we get a silent failure.
of course, it depends on the specific case. in case of ZnServer, this might be not a good idea. But i just described why it happens and how to prevent it.
- defer initiating/rebinding socket connections untill a system will finish startup using Smalltalk addDeferredStartupAction: [ .... ] like following:
ZnServer class >> startUp: resuming "Our system startUp hook: start all servers we manage"
(resuming or: [ self alwaysRestart ]) ifTrue: [ Smalltalk addDeferredStartupAction: [ self managedServers do: [ :each | each start ] ] ]
like that, if image runs headless, it will still quit to OS, since nobody handling the exception(s) when server cannot bind to specified port, while if you run image headful, it will open a debugger.
OK, I didn't know about deferred startup actions, that sounds like a good idea indeed. I'll try to add that.
The rationale behind this is following: in startup you put things which is _absolutely neccessary_ for image to function properly. Like that, any registered service which failed to startup properly, renders an image invalid/non-functional, which of course means, that any error (if it happens) is unrecoverable, and it makes little sense to continue running image (since one of its basic services are faulted) and hence we the only choice we have is to quit graciously: dump error(s) to log and quitting to OS. (For example, imagine that event handling startup is failed, in this case you will get an unresponsive image, which don't reacts to any user input). What you will prefer: a log file , showing what happen, or unresponsive image without any clue what happens (and which you have to kill manually anyways)? In case of Zn server, apparently, it is not absolutely necessary to bind socket(s) during startup phase, because image will function properly with or without them. So deferring this action after startup is finished, is the right way to do it. Unless, again, you interested in running only image(s) which were able to successfully bound socket(s) to desired port(s).
Thanks a lot for the input !
Sven
-- Best regards, Igor Stasenko.
On 29 Sep 2012, at 20:09, Igor Stasenko <siguctua@gmail.com> wrote:
In case of Zn server, apparently, it is not absolutely necessary to bind socket(s) during startup phase, because image will function properly with or without them. So deferring this action after startup is finished, is the right way to do it.
--- Name: Zinc-HTTP-SvenVanCaekenberghe.307 Author: SvenVanCaekenberghe Time: 29 September 2012, 9:00:49.72 pm UUID: 9387492b-daa2-4ebf-a49d-44950586bda3 Ancestors: Zinc-HTTP-SvenVanCaekenberghe.306 Modified ZnServer class>>#startUp: to use a deferred startup action to start all registered servers; this should allow for normal error handling when something goes wrong initializing server sockets (thanks Igor Stasenko for the fix; thanks Denis Kudriashov for the error report) --- -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
Thanks Sven. I created an issue. BTW esteban was making progress on a simpler integration process and it will easier for non core people to commit :). Stef On Sep 29, 2012, at 9:02 PM, Sven Van Caekenberghe wrote:
Name: Zinc-HTTP-SvenVanCaekenberghe.307 Author: SvenVanCaekenberghe Time: 29 September 2012, 9:00:49.72 pm UUID: 9387492b-daa2-4ebf-a49d-44950586bda3 Ancestors: Zinc-HTTP-SvenVanCaekenberghe.306
Modified ZnServer class>>#startUp: to use a deferred startup action to start all registered servers; this should allow for normal error handling when something goes wrong initializing server sockets (thanks Igor Stasenko for the fix; thanks Denis Kudriashov for the error report)
Hello. Thank's for fix. I check it for latest pharo (from jenkins). It's work. Now debugger appears when ZnServer can't start during pharo startup. Best regards, Denis 2012/9/30 Stéphane Ducasse <stephane.ducasse@inria.fr>
Thanks Sven. I created an issue.
BTW esteban was making progress on a simpler integration process and it will easier for non core people to commit :).
Stef On Sep 29, 2012, at 9:02 PM, Sven Van Caekenberghe wrote:
Name: Zinc-HTTP-SvenVanCaekenberghe.307 Author: SvenVanCaekenberghe Time: 29 September 2012, 9:00:49.72 pm UUID: 9387492b-daa2-4ebf-a49d-44950586bda3 Ancestors: Zinc-HTTP-SvenVanCaekenberghe.306
Modified ZnServer class>>#startUp: to use a deferred startup action to start all registered servers; this should allow for normal error handling when something goes wrong initializing server sockets (thanks Igor Stasenko for the fix; thanks Denis Kudriashov for the error report)
Hi Denis, Thanks a lot for the testing and the error report; we need more Windows people. I just tested the same sequence on Mac OS X 10.8.2 with Pharo 20315 and for me the image never crashes when the port is already in use. It just doesn't work, the socket isValid but isListening is false because of the self serverSocket localPort = self port clause. The same about starting two servers on the same port in one image. Actually that is why I originally added the #isListening test. It all comes down to how the primitives are implemented, and for sockets they are for sure different on each platform. Sven On 29 Sep 2012, at 14:39, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hello.
I try it for latest pharo2.0 one click. Same results. I am on Windows 7.
First I register ZnServer at workspace:
server := ZnServer on: 10025. server start. server register server isRunning & server isListening.
Then save image. When I reopen image server is running. Now if I run other application at same port and try to open pharo It will closed with pharoDebug about anable to create socket. No chance to debug and fix it.
I think it is very bad behaviour because it make impossible to run my image at different computers just because another application holds socket.
There is one strange thing. When I open another ZnServer on another image both images works nice. "server isRunning & server isListening." returns true for both. And same happens if I doing it from one single image. It is possible to create two ZnServer's for same port. Only one accept requests from webbrowser for example. But when I closed it another ZnServer start accept requests. I think I just don't know something about sockets but it looks very strange to me.
Best regards, Denis
2012/9/24 Mariano Martinez Peck <marianopeck@gmail.com>
On Mon, Sep 24, 2012 at 10:44 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote: The behavior you are seeing is standard behavior for a headless image, are you running headless or not ?
I think that if the problem comes from the startUp processing, this is the standard behavior whether it is headless or not. But I may be wrong.... Igor/Esteban? I remember discussing this....
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
On 24 Sep 2012, at 10:21, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I am on Windows 7
2012/9/24 Denis Kudriashov <dionisiydk@gmail.com> Ok, I will look at mails.
In short: Start new seaside image. Add new zinc adaptor on port 10025 (for example). Save and close image. Block this port by firewall. Start image. It should close immediately.
I have pharoDebug with THERE_BE_DRAGONS_HERE Error: Cannot create socket on port 10025 24 September 2012 12:18:00.807 pm
VM: Win32 - IX86 - 6.1 - CoInterpreter VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.161 uuid: 8e0c22c3-b48d-4d8d-a7f9-8a75dc246f28 Jul 11 2012, https://git.gitorious.org/cogvm/blessed.git Commit: 8eb3f452262d1b213fd1b6fd3cb682e292945ccf Date: Mon Jul 9 15:23:19 2012 +0200 By: Esteban Lorenzano <estebanlm@gmail.com> Image: Pharo1.4 [Latest update: #14456]
2012/9/24 Stéphane Ducasse <stephane.ducasse@inria.fr> Check the mailing-list because this was already discussed. igor and other spent time to streamline this process in particular in headless mode.
So can you tell us a bit more what you are doing and when?
Stef
Hello.
I found very bad behaviour. I use Pharo1.4. And when there is some errors at startup Image just closed. It is horrible
I have image with seaside application which open socket at startup. So when I move to another computer where this port is busy (or closed by firewall) Pharo opened and immediately closed. No chance to debug and fix it.
What you think about it? Is it fixed already at pharo 2.0?
Best regards Denis
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
participants (5)
-
Denis Kudriashov -
Igor Stasenko -
Mariano Martinez Peck -
Stéphane Ducasse -
Sven Van Caekenberghe