mt-mods / technic

Technic mod for Minetest
18 stars 25 forks source link

ServerError: AsyncErr: environment_Step: Runtime error from mod 'technic' in callback environment_Step() #191

Closed AmyMoriyama closed 3 years ago

AmyMoriyama commented 3 years ago

https://bin.byreqz.de/?e9651043ba1e2396#CsL6M5rDkp4CWhrfRiUR8ktFZkLfyNiQmSWve4rhCNex

Ran into this error trying to run my server after install. Obtained mod from github via git.

OgelGames commented 3 years ago
2021-07-07 18:26:45: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'technic' in callback environment_Step(): ...echnic/technic/machines/switching_station_globalstep.lua:33: attempt to compare number with nil
2021-07-07 18:26:45: ERROR[Main]: stack traceback:
2021-07-07 18:26:45: ERROR[Main]:   ...echnic/technic/machines/switching_station_globalstep.lua:33: in function <...echnic/technic/machines/switching_station_globalstep.lua:24>
2021-07-07 18:26:45: ERROR[Main]:   /home/username/multicraft/bin/../builtin/game/register.lua:456: in function </home/username/multicraft/bin/../builtin/game/register.lua:440>
2021-07-07 18:26:45: ERROR[Main]: stack traceback:

https://github.com/mt-mods/technic/blob/fd4bece11a633e665cf73c782bb1d2032169ee88/technic/machines/switching_station_globalstep.lua#L31-L33

Seems like the hacky way max lag is pulled from the server status message is the problem here.

What version of minetest are you running, and do you have any mods that effect the server status message?

AmyMoriyama commented 3 years ago

I don't know either right off hand as the server is hosted and the host compiles the minetest. I suspect that there could be a potential mod conflict as there are a lot of mods including a lot of new ones. Technic worked when I first got hosted not even a month ago, but since then I have changed the mod set a few times to get it more like I want.

OgelGames commented 3 years ago

Related: https://github.com/mt-mods/technic/issues/166 https://github.com/minetest/minetest/pull/11077

S-S-X commented 3 years ago

Some mods override status message to make it pretty with colors, less technical information and more easy to understand information for players. It is not meant to be machine readable but technic does treat it as if it was machine readable.

This is also documented for engine, it is meant to be only human readable:

BuckarooBanzay commented 3 years ago

I added some compatibility code in case the /status parsing fails here: #192

OgelGames commented 3 years ago

This comment basically provides the answer to monitor the max lag from the mod: https://github.com/minetest/minetest/pull/5523#issuecomment-311490292

float max_lag = m_env->getMaxLagEstimate();
max_lag *= 0.9998; // Decrease slowly (about half per 5 minutes)
if(dtime > max_lag){
    if(dtime > 0.1 && dtime > max_lag * 2.0)
        infostream<<"Server: Maximum lag peaked to "<<dtime
                <<" s"<<std::endl;
    max_lag = dtime;
}
m_env->reportMaxLagEstimate(max_lag);

https://github.com/minetest/minetest/blob/e9bc59e376f88f1d4d1c6d3fedf62d9049e3e60d/src/server.cpp#L596-L604