Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008952opensim[MISC] Compiling / Buildingpublic2021-12-12 04:132021-12-12 05:57
Reporterrory.slegtenhorst 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Statuspatch includedResolutionopen 
PlatformDockerOperating SystemUbuntu Linux & WSLOperating System Version20.04
Product Version 
Target VersionFixed in Version 
Summary0008952: Better signal handing for Linux/Docker/WSL support
DescriptionThe existing signal handlers in 0.9.1.1 are not adequate and contain typo's. And to my surprise, this code was removed entirely from 0.9.2.0.

I present two patches, one for each version, to add proper signal handling once again. This will allow both OpenSim.exe/Robust.exe to correctly shut down when being sent a INT or TERM signal.

I ensured that the Mono.Posix reference is only included if the _MONO constant is defined. The code itself is properly #if'd into place.

Sidenote:
I remember asking for signal support almost 10 yrs ago. I am unsure who the original author was, but I did find a patch on an old server backup matching the typo. And I am by no means a .Net developer :D
I am using a Dockerfile to build the sources using mono:latest. The final result is an image that matches all the files from the binary distribution.
Steps To ReproduceBuild using: msbuild /p:Configuration=Release /p:DefineConstants=_MONO /m

When running in either Linux, Docker or WSL, this allows "Ctrl-C" from interactive shells, and allows catching the signals INT and TERM which will shutdown the applications.

Most notably, when running in Docker this allows to correctly stop the application on "docker stop".
Additional InformationThe OpenSim.exe binary is very chatty and clearly shows the shutdown process, after which you get your command line prompt back quickly.

Robust.exe however, does log the message I added, but the end result leaves something to be desired for. It takes a few seconds to actually shutdown compared to typing quit on the console. My debugging skills are very lacking at this point.

I did think that moving the code to OpenSim/Framework/Servers/ServerBase.cs was the better choice though.

Since this *is* my first official patch, I'd really love to hear some feedback :)
TagsNo tags attached.
Git Revision or version number0.9.1.1 and 0.9.2.0
Run ModeStandalone (1 Region) , Standalone (Multiple Regions) , Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
Physics EngineBulletSim
Script EngineXEngine
EnvironmentMono / Linux64, .NET / Windows64
Mono Version6.x
Viewer
Attached Filesdiff file icon 01-signal-handling-0.9.2.0.diff [^] (3,312 bytes) 2021-12-12 04:13 [Show Content]
diff file icon 01-signal-handling-0.9.1.1.diff [^] (7,724 bytes) 2021-12-12 04:18 [Show Content]

- Relationships

-  Notes
(0038288)
rory.slegtenhorst (reporter)
2021-12-12 04:15

See attached diff files for patches to both 0.9.1.1 and 0.9.2.0
(0038289)
rory.slegtenhorst (reporter)
2021-12-12 04:45

In 0.9.2.0, the shutdown handler in Robust.exe actually works as expected, and is not waiting for a new line to be sent to the console.
(0038290)
UbitUmarov (administrator)
2021-12-12 05:57

Thanks,
sig handler code was added my Melanie, i made a few changes and then did remove

I did instead improved handling of cntr-c.
So 0.9.2.0 does not need to ship with a mono only dll.

in linux i see 0.9.2.0 respond to SIGINT doing a controlled shutdown,
while SIGTERM does direct kill of the application, as spec.

the conditional _Mono compile does not work because we only have one version of binaries for all platforms, in our case compiled on linux. Others compile on Windows also run on several platforms.
so the flag needs to be always set, and Mono.Posix.dll must be included in package
Something i just do not want to keep doing, since it is just useless and a door for potential problems.
(it is loaded on windows .Net runtime to not be called, and hopefully ignored by mono runtime that should find its own local version. ofc is one of this ignores fails, something may just blowup)

- Issue History
Date Modified Username Field Change
2021-12-12 04:13 rory.slegtenhorst New Issue
2021-12-12 04:13 rory.slegtenhorst File Added: 01-signal-handling-0.9.2.0.diff
2021-12-12 04:15 rory.slegtenhorst Note Added: 0038288
2021-12-12 04:15 rory.slegtenhorst Status new => patch included
2021-12-12 04:18 rory.slegtenhorst File Added: 01-signal-handling-0.9.1.1.diff
2021-12-12 04:45 rory.slegtenhorst Note Added: 0038289
2021-12-12 05:57 UbitUmarov Note Added: 0038290


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker