Dangling sockets on un-graceful mgserver shutdown on Linux

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dangling sockets on un-graceful mgserver shutdown on Linux

Jackie Ng
Hi All,

I've been noticing that whenever mgserver ungracefully shuts down whether by segfault or by being killed off by kill/killall, the TCP/IP ports opened by MapGuide will not be properly released. Attempting to restart mgserver will generally fail due to the ports being in use.

The ports will eventually be available after waiting a few minutes after the un-graceful mgserver shutdown. Is there a way that mgserver can listen for SIGSEGV and/or SIGKILL (presumably the signals that are raised when such events happen) and perform any necessary socket clean up before bailing?

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Dangling sockets on un-graceful mgserver shutdown on Linux

Even Rouault-2
Le jeudi 02 octobre 2014 14:07:11, Jackie Ng a écrit :

> Hi All,
>
> I've been noticing that whenever mgserver ungracefully shuts down whether
> by segfault or by being killed off by kill/killall, the TCP/IP ports
> opened by MapGuide will not be properly released. Attempting to restart
> mgserver will generally fail due to the ports being in use.
>
> The ports will eventually be available after waiting a few minutes after
> the un-graceful mgserver shutdown. Is there a way that mgserver can listen
> for SIGSEGV and/or SIGKILL (presumably the signals that are raised when
> such events happen) and perform any necessary socket clean up before
> bailing?

I don't think so. You cannot really do anything useful and reliable in signal
handlers

However http://stackoverflow.com/questions/6380057/python-binding-socket-
address-already-in-use might help. Basically you can try setting the socket
option SO_REUSEADDR before binding.

Even

>
> - Jackie
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Dangling-sockets-on-un-graceful-mgserv
> er-shutdown-on-Linux-tp5165499.html Sent from the MapGuide Internals
> mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-internals mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Reply | Threaded
Open this post in threaded view
|

Re: Dangling sockets on un-graceful mgserver shutdown on Linux

Jackie Ng
MapGuide Server uses ACE for networking, I do see some references to SO_REUSEADDR in regards to ACE so this option may be exposed or abstracted so we might be able to do something here. Thanks for the heads up.

- Jackie