Author Topic: 3.7.2 + lua socket crashes  (Read 2602 times)

0 Members and 1 Guest are viewing this topic.

3.7.2 + lua socket crashes
Hello,

a few days ago i tried to use the 3.7.2 exe for my fs2.

Unfortunately the game crashes but the debug log tells me nothing about the crash. :(

Code: [Select]
.
.
.
cfile_init() took 81
TrackIR Init Failed - 1
Got event GS_EVENT_GAME_INIT (49) in state NOT A VALID STATE (0)
PLR => Loading 'Askahain.plr' with version 2...
PLR => Parsing:  Flags...
PLR => Parsing:  Info...
PLR => Parsing:  Scoring...
PLR => Parsing:  ScoringMulti...
PLR => Parsing:  HUD...
PLR => Parsing:  Variables...
PLR => Parsing:  Multiplayer...
PLR => Parsing:  Controls...
PLR => Parsing:  Settings...
Someone passed an extension to bm_load for file 'thunderlords.pcx'
PLR => Loading complete!
PLR => Verifying 'Askahain.plr' with version 2...
PLR => Parsing:  Flags...
PLR => Parsing:  Info...
PLR => Verifying complete!
After a little bit of testing i found the problem that caused the crash but i don't know why.

The problem was in the scripting tables. I have a modular table that opens a lua socket
Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$On State Start:
[
socket=require("socket")
]
#End
if i comment this line the game works. if i don't the game crashes.

In 3.7.1 it works without any problem and if i try it with lua on the command line it is still no problem
Code: [Select]
D:\Spiele\Diaspora>lua5.1.exe
Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> socket = require("socket")
> print(socket._VERSION)
LuaSocket 2.0.2
>

Can somebody give me a hint why the luasocket won't work with the 3.7.2 exe ?

With kind regards

Askahain

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: 3.7.2 + lua socket crashes
Does it still not work with a recent Nightly Build?
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
I'm a bit surprised that it worked with 3.7.1, the internet says that lua needs to be linked dynamically in order to load an external DLL but we currently link lua statically into our executable.
Did our build process change in some way since 3.7.1?

 
Re: 3.7.2 + lua socket crashes
I tested it with the Version "fs2_open_3_7_3_SSE_20151006_61f2e78.exe" (nightly build) and it don't work.

but i have tested many nightly builds to find the last working version.

The last working version was r10753 the next version (don't working) was r10758

as far as i can see in the change log there was a change in release 10756
[Added multiple scripting features related to messaging as requested by Axem.] by m_m

Maybe there where changed something that cause the crash. I hope somebody can help with this because it will take weeks for me to understand the many changes in c code :)

With kind regards

Askahain

P.s. i get luasocket from this page http://files.luaforge.net/releases/luasocket/luasocket (Version 2.0.2) (if somebody will test it)

 
Re: 3.7.2 + lua socket crashes
Hmm, anyone who can help with this ?

 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
Sorry for the delay :nervous:

First, thanks for narrowing down the revision range. That should help tracking down what's the issue here.

As you mentioned the only scripting related change was done by me but as far as I can tell it shouldn't affect how lua loads external modules at all.

You mentioned that FSO would "crash". What do you mean by that? Does it show the usual "FreeSpace Open has stopped working" dialog or is there a dialog generated by FSO (you might habe to run a debug build to check this as only those show all warning messages)?

 
Re: 3.7.2 + lua socket crashes
Hello,

here is a screenshot of the crash.


Here are the configure debug_filters
Code: [Select]
+General
-Parse
+OpenAL
+SHADER-DEBUG
+Error
+BmpMan
+Paging
+Network
+Sandeep
+BmpFastLoad
+Sound
+Maps
+Model
+SEXP
+Warning
+wash
+AB TRAIL
+Weapons
+BmpInfo
+BMP DEBUG
+Alan
+lethality
+Joystick
+Particles
+AI
+ModelAnim
+Messaging
+Beam
+Physics
+allender
+CSG
+Fred routing
+EVENTMUSIC
+OpenGL
+missionlog
+Jim
+lightning
+CFileDebug

Here is (very long) the fs2_open.log http://battlestar.askahain.de/DonwloadOpen/fs2_open.log


 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
mjn.mixael tested the script with the latest git version but everything worked properly but there is one thing you might try. In the download of luasocket you linked to there is a file valled "lua5.1.dll". Can you try extracting that to the directory of the FSO executable you are using?

 
Re: 3.7.2 + lua socket crashes
Ok now its very strange.

Testresult: Freespace 2 SCP 3.7.3(20151006) is working / Diaspora 3.7.3(20151006) isn't working.

What i have done:

I have installed Diaspora on a new system. Patched Diaspora to 1.1. Patched Diaspora to 1.1.1.
Copied the luasocket to the directory.
Code: [Select]
+ Disporadir
| lua5.1.exe
|  lua5.1.dll
+ mime
|  | core.dll
+ socket
|  | core.dll
+ lua
   | socket.lua
   | ltn12.lua
   | mime.lua
   + socket
      | ftp.lua
      | http.lua
      | smtp.lua
      | tp.lua
      | url.lua

Copied fs2_open_3_7_3_SSE_20151006_61f2e78.exe to the Diaspora dir.

Diaspora is working

Copied udp-sct.tbm in the table dir
Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$On State Start:
[
socket=require("socket")
]

#End

Diaspora Crashes

---------------------------------------
Next test with Freespace 2

Installed Freespace 2 with the automatic install tool. (FS2 Open + MediaVP, no mods)

Copied luasocket to the Freespace 2 dir (same as above)

Copied fs2_open_3_7_3_SSE_20151006_61f2e78.exe to the Diaspora dir.

Copied udp-sct.tbm in the table dir

Freespace 2 is working (no crash).

I will now check what the difference between the two installations is. I will report what the result is.


 
Re: 3.7.2 + lua socket crashes
Hello,

i think i have found the part that crashes the game.

The problem is found in diaspora patch 1.1.1. If i delete the patch everything works fine.

So what have change with the patch ? In the patch is 1 tbm and 2 missions.

A little bit try an error in the tubeLaunch-sct.tbm an i found the point an which the game crashes.

The script have a Global Hooks section
Code: [Select]
#Global Hooks
$Simulation:
[
if (tubeLaunches ~= nil) then
    tubeLaunches:onFrame()
end
]
#End

if i comment this section the game don't crashes. After a little bit of testing it shows that the $Simulation part is the problem.

This works
Code: [Select]
#Global Hooks

#End

This don't work
Code: [Select]
#Global Hooks

$Simulation:
[
]
#End

The question is why crashes the "$Simulation" Section the game if i "require" the luasocket since version r10758.

I hope this helps to find the problem. (If you need more or more detailed information please ask)

With kind regards

Askahain
« Last Edit: October 21, 2015, 06:42:04 am by Askahain »

 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
That's certainly very intersting and means that something is broken inside FSO. I'll try to reproduce the crash on my computer later today, if it's a cross-platform issue then tracking it down shouldn't be hard.  Does it also crash if you only use retail data (+ the two script files)?

 
Re: 3.7.2 + lua socket crashes
On the retail version i can't reproduce the error with the two scripts.

But i have found some other interesting part.

As i get back the original version of the script i see that the block is multi line commented.

Code: [Select]
;--[[
;; General Documentation:
;; This script supports the launch from a moving and even turning battlestar. There are some issues when the battlestar is accelerating where a small displacements is observable but once the ship has reached a given speed this disappears.

#Global Hooks

$Simulation:
[
if (tubeLaunches ~= nil) then
    tubeLaunches:onFrame()
end
]
;]]

#End

So there are two funny things
1. There should be a problem because the "Global Hooks" Section is commented but the "#End" Section isn't. So there is a end section without a start section. (On my test i accidentally repaired this).

2. If i implement a mistake in the commented code (for example changed "~=" to "~x=" the game generates me a scripting error. Is there maybe a problem with the comments, too ?

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: 3.7.2 + lua socket crashes
On the retail version i can't reproduce the error with the two scripts.

But i have found some other interesting part.

As i get back the original version of the script i see that the block is multi line commented.

Code: [Select]
;--[[
;; General Documentation:
;; This script supports the launch from a moving and even turning battlestar. There are some issues when the battlestar is accelerating where a small displacements is observable but once the ship has reached a given speed this disappears.

#Global Hooks

$Simulation:
[
if (tubeLaunches ~= nil) then
    tubeLaunches:onFrame()
end
]
;]]

#End

So there are two funny things
1. There should be a problem because the "Global Hooks" Section is commented but the "#End" Section isn't. So there is a end section without a start section. (On my test i accidentally repaired this).

2. If i implement a mistake in the commented code (for example changed "~=" to "~x=" the game generates me a scripting error. Is there maybe a problem with the comments, too ?
The "problem" here is that those Lua comment blocks are themselves... commented out (notice the semicolons). They don't actually make sense outside of a hook anyway. If you wanted to comment out the entire hook, you'd need to use FSO's multi-line comment syntax, which is either "/*" and "*/", or "!*" and "*!" (either style works, but you can't intermix the two).
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: 3.7.2 + lua socket crashes
Ok thank you for this information about the comments. I will send it to the Diaspora Team. This is one of their scripts.

 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
It's actually my script which I created for Diaspora. I think I added that comment to make my editor stop complaining about the tables syntax in a lua file.

 
Re: 3.7.2 + lua socket crashes
Oh, ok sorry :)
Then ignore the post in the Diaspora Tech forum :)

 
Re: 3.7.2 + lua socket crashes
Just to explain why the luasocket and diaspora is so important for me.
This are the parts that running my vipercockpit V1. At the moment i try plan a cockpit v2 (to remove all the mistakes i made and make it nicer an more functional) but for this all systems should run fine :)

Picture from Cockpit V1 inside:


More Pictures: http://larptech.de/index.php?S=viperbau

 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
Ok, I got around to testing it on my machine but I sadly can't reproduce the issue and I also don't have a Windows install at the moment.

I'll see if I can get someone on Windows to test this.

 
Re: 3.7.2 + lua socket crashes
Ok thank you very much.

If i can help you with something just tell me.

With kind regards

Askahain

 

Offline m!m

  • 211
Re: 3.7.2 + lua socket crashes
Well, if you want to install Visual Studio you could try following this guide which would give me an indication where FreeSpace is crashing.