MantisBT - Doomseeker
View Issue Details
0003324Doomseeker[All Projects] Bugpublic2017-11-03 12:382018-10-27 22:55
WubTheCaptain 
Zalewa 
normalmajorsometimes
closedfixed 
x86_64Debian GNU/Linuxbuster/sid
1.1 
1.21.2 
0003324: RCon client process stays alive after RCon fails and init is finished, doesn't exit normally after error
Failed RCon client initialization can keep the RCon client running in background, wasting host computer resources (e.g. memory). LookupHost thread is never finalized.

Ideally, it should return to the dialog asking for server details, or exit gracefully.
Start Doomseeker in RCon client mode, preferably from a terminal for stdout:

$ doomseeker --rcon
[12:23:28] Starting Doomseeker. Hello World! :)
...
[12:23:28] Starting RCon client.


Try an engine which doesn't support RCon (currently as of writing, anything but Zandronum). The server address and password don't seem to matter, I've set both to blank (null).

The following two lines (ignoring the timestamp) should be appended to stdout:

[12:23:30] Init finished.
================================


An error should also be printed about lack of support.

Notice the process is still alive but nothing is happening. This is verifiable with pgrep (GNU/Linux):

$ pgrep doomseeker
28567


Repeating these steps will create more processes, which can be found with pgrep.

Ctrl + C (^C) will forcefully terminate the process.
Reproducible in 1.2~beta-171103-0428. This does not happen when the plugin is specified from command line:

$ doomseeker --rcon ChocolateDoom localhost
[12:37:39] Starting Doomseeker. Hello World! :)
...
[12:37:39] Starting RCon client.
[12:37:39] Plugin does not support RCon.
$ 


(I thought I already reported this. I guess I didn't, sorry!)
No tags attached.
related to 0003374closed WubTheCaptain Bad English grammar in canAnyEngineRcon error string 
Issue History
2017-11-03 12:38WubTheCaptainNew Issue
2017-11-03 12:44WubTheCaptainSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11264#r11264
2017-11-03 12:44WubTheCaptainSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11265#r11265
2018-02-14 13:13ZalewaAssigned To => Zalewa
2018-02-14 13:13ZalewaStatusnew => assigned
2018-02-14 14:09ZalewaNote Added: 0019039
2018-02-14 14:09ZalewaStatusassigned => needs testing
2018-02-15 01:30WubTheCaptainStatusneeds testing => resolved
2018-02-15 01:30WubTheCaptainResolutionopen => fixed
2018-02-15 01:30WubTheCaptainTarget Version => 1.2
2018-02-15 01:30WubTheCaptainFixed in Version => 1.2
2018-02-15 03:09WubTheCaptainNote Added: 0019045
2018-02-15 03:09WubTheCaptainStatusresolved => assigned
2018-02-15 03:09WubTheCaptainResolutionfixed => reopened
2018-02-15 03:35WubTheCaptainNote Added: 0019046
2018-02-15 03:40WubTheCaptainNote Edited: 0019046bug_revision_view_page.php?bugnote_id=19046#r11397
2018-02-15 03:49WubTheCaptainNote Added: 0019047
2018-02-15 03:51WubTheCaptainNote Edited: 0019047bug_revision_view_page.php?bugnote_id=19047#r11399
2018-02-15 03:53WubTheCaptainNote Edited: 0019047bug_revision_view_page.php?bugnote_id=19047#r11400
2018-02-15 03:53WubTheCaptainNote Edited: 0019047bug_revision_view_page.php?bugnote_id=19047#r11401
2018-02-15 03:55WubTheCaptainNote Edited: 0019047bug_revision_view_page.php?bugnote_id=19047#r11402
2018-02-15 07:24ZalewaNote Added: 0019048
2018-02-15 07:31ZalewaNote Added: 0019049
2018-02-15 09:52ZalewaNote Added: 0019052
2018-02-15 09:52ZalewaStatusassigned => needs testing
2018-02-15 17:41WubTheCaptainNote Added: 0019054
2018-02-15 18:21WubTheCaptainStatusneeds testing => needs review
2018-02-15 20:07ZalewaNote Added: 0019056
2018-02-15 20:07ZalewaStatusneeds review => needs testing
2018-02-16 08:11WubTheCaptainNote Added: 0019057
2018-02-16 08:11WubTheCaptainStatusneeds testing => resolved
2018-02-16 08:11WubTheCaptainResolutionreopened => fixed
2018-02-16 08:25WubTheCaptainRelationship addedrelated to 0003374
2018-10-27 22:55WubTheCaptainStatusresolved => closed

Notes
(0019039)
Zalewa   
2018-02-14 14:09   
Fix:'https://bitbucket.org/Doomseeker/doomseeker/commits/7b9605ec4ad6b35ca46ec12537637787a97bfd06 [^]'
(0019045)
WubTheCaptain   
2018-02-15 03:09   
I'm going to reopen this, because the exit code is screwed:

$ /tmp/doomseeker/doomseeker --rcon
[... no RCon support is triggered here ...]
$ echo $?
0


1.2~beta-180214-1407
(0019046)
WubTheCaptain   
2018-02-15 03:35   
(edited on: 2018-02-15 03:40)
I notice you've done something to fix another (unrelated) bug with exit codes in 1.1:

In 1.1, no Chocolate Doom installed:

$ doomseeker --rcon ChocolateDoom localhost
[...]
[03:23:01] Couldn't find specified plugin: ChocolateDoom
$ echo $?
0


Also in 1.1, but with Chocolate Doom installed:

$ doomseeker --rcon ChocolateDoom localhost
[...]
[03:27:29] Plugin does not support RCon.
LookupHostConsumerThread: 0x7fbb6f93b700 
$ echo $?
0


But in 1.2~beta-180214-1407, without Chocolate Doom:

$ /tmp/doomseeker/doomseeker --rcon ChocolateDoom localhost
[...]
[03:34:10] Starting RCon client.
[03:34:10] Couldn't find specified plugin: ChocolateDoom
$ echo $?
2


and 1.2~beta-180214-1407 with Chocolate Doom:

$ /tmp/doomseeker/doomseeker --rcon ChocolateDoom localhost
[...]
[03:27:19] Plugin does not support RCon.
[03:27:19] Finalizing LookupHost thread
LookupHostConsumerThread: 0x7f16321d1700
[03:27:20] Finalized LookupHost thread
$ echo $?
2


but the exit code 0 is still a thing when the plugin is not specified from the command line.

(EDIT: Lol, I accidentally found this via experimentation before reading the actual code changes in the commit.)

(0019047)
WubTheCaptain   
2018-02-15 03:49   
(edited on: 2018-02-15 03:55)
I also note that there's no convention for non-0/1 exit values. Exit code 2 is a bash shell builtin misuse thing, a user/command error.

There's sysexits(3) for preferable exit codes for programs on FreeBSD, but... yeah...

(0019048)
Zalewa   
2018-02-15 07:24   
Exit codes are what programmer wants them to be. In our case non-zero means error. I don't use 1 because on Windows 1 can be a success code too, generated by Windows, and there's nothing you can do about it.
(0019049)
Zalewa   
2018-02-15 07:31   
The actual problem with "No RCon" support is that the port should not be listed if it doesn't have RCon.
(0019052)
Zalewa   
2018-02-15 09:52   
This commit should disallow quitting "--rcon" with an error condition:'https://bitbucket.org/Doomseeker/doomseeker/commits/cfedcedc860336f11118fb0a569dd867e3dc38fc [^]'
(0019054)
WubTheCaptain   
2018-02-15 17:41   
Quote from Zalewa
I don't use 1 because on Windows 1 can be a success code too, generated by Windows, and there's nothing you can do about it.


EXIT_FAILURE from stdlib.h?
(0019056)
Zalewa   
2018-02-15 20:07   
Regardless, unless there's '0' returned where a clear failure occurs, I won't be changing the exit codes. It's beyond this ticket too. So, if Doomseeker doesn't get stuck anymore, I will consider this as resolved.
(0019057)
WubTheCaptain   
2018-02-16 08:11   
Functionally this issue has been fixed, although I'll create another issue ticket about a possible small typo introduced now.

Thanks.