View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001921SphereServerexecutable - linux buildpublic27-02-11 17:4606-08-14 12:10
Reportertrinax 
Assigned ToXuN 
PrioritynormalSeveritymajorReproducibilitysometimes
StatusclosedResolutionfixed 
PlatformLinuxOSDebianOS Version5.0
Product Version20-09-2009, 0.56b Prerelease 
Target VersionFixed in Version0.56c Nightly 
Summary0001921: 'Main' thread hang if db.query used too much
DescriptionI have a script that opens up a dialog that uses db.query when players go into war mode. Sometimes the thing below happens:

16:35:P'Feto' was killed by P'Biscuit'.
16:36:CRITICAL:(event.scp,6787)'Main' thread hang, restarting...

and after the thread restart, logs have the script name on every line:
16:48:(event.scp,6787)World save completed, took 1.0000 seconds

Line 6787 is:
db.query "select name, killamount, uid from the_table where team=2 order by killamount desc";
It is inside a dialog.

Going war mode has a cooldown of a few secs during the event but still this happens when too many people hit tab at the same time I think.

I may be wrong but I think when this happens for the second time without a complete restart, sphere crashes with no error.

TagsNo tags attached.
Nightly VersionAutomated (specify build number)
Experimental FlagsDiagonalWalkCheck, New_Triggers, WalkCheck, AllowTelnetPacketFilter, NetworkOutThread
Option FlagsCommand_Sysmsgs, FileCommands
Internal Build Number1420
Attached Files

- Relationships

-  Notes
(0000957)
MrSugarCube (administrator)
13-03-11 04:14

What is the value of the FreezeRestartTime setting in sphere.ini?

I expect that the cause of this is that there's too much processing going on in the script (and/or the database isn't returning the results fast enough) and Sphere thinks that the process has frozen.

Increasing FreezeRestartTime may help. Another option could be to use asynchronous queries (db.aquery/aexecute) if the query is taking a long time to finish.
(0000961)
trinax (reporter)
13-03-11 10:00
edited on: 13-03-11 13:18

FreezeRestartTime is 15 seconds. The table usually has 30~rows only. I have just noticed there is two queries in the dialog. Each of them is working with a <local> like this.

db.query "select name, k, serial from cs where team=1 order by k desc";
if (<db.row.numrows> > 0)
for x 0 <eval <db.row.numrows>-1>
local.ct <local.ct><db.row.<dlocal.x>.name> - <db.row.<dlocal.x>.k> <qval <db.row.<dlocal.x>.serial>?- [DEAD]:><def.br>
endfor
endif
db.query "select name, k, serial from cs where team=2 order by k desc";
if (<db.row.numrows> > 0)
for x 0 <eval <db.row.numrows>-1>
local.ct <local.ct><db.row.<dlocal.x>.name> - <db.row.<dlocal.x>.k> <qval <db.row.<dlocal.x>.serial>?- [DEAD]:><def.br>
endfor
endif

I will try melting the two queries together and see if it is fixed then.

(0002366)
XuN (developer)
23-07-14 19:48

If the MySQL server is not on the same machine you should try to use aquery, or you'll have to wait until the data come back. If this is not the case ... is it still happening?

- Issue History
Date Modified Username Field Change
27-02-11 17:46 trinax New Issue
13-03-11 04:14 MrSugarCube Note Added: 0000957
13-03-11 10:00 trinax Note Added: 0000961
13-03-11 13:18 trinax Note Edited: 0000961 View Revisions
23-07-14 19:48 XuN Note Added: 0002366
06-08-14 12:10 XuN Status new => closed
06-08-14 12:10 XuN Assigned To => XuN
06-08-14 12:10 XuN Resolution open => fixed
06-08-14 12:10 XuN Fixed in Version => 0.56c Nightly


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker