belstgut Posted June 13, 2016 Share Posted June 13, 2016 (edited) Hi, I am currently trying to get luasocket working in one of my luascripts. I got luasocket compiled against the 32bit liblua53 and moved it to silent/lualibs. I still got following problem though. It seems like silent lua extension does NOT reexport modules like lua_gettop I get: socket/core.so: undefined symbol: lua_gettop i found this: https://github.com/siffiejoe/lua-moon/ I am not sure if I just failed to compile it correctly but after requireing sofix in my lua module I still get the same error. (the require works though.) Edited June 13, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted June 14, 2016 Management Share Posted June 14, 2016 You're using the qagame binary from the dynamic_lua directory in the zip? That is necessary for external libraries to be used. Other than that, I don't know what could be wrong. Maybe TheSilencerPL has some insight. belstgut 1 Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 14, 2016 Author Share Posted June 14, 2016 woah thanks. linking it to the qagame shared object worked. I was trying to link it against liblua53.so. setting MOON_DLFIX_LIBNAME to qagame.i386.so worked thanks Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 14, 2016 Author Share Posted June 14, 2016 (edited) Am I blind or is there really no edit function for posts? well anyway, Now the module loads and works and stuff, BUT I cant do http requests.It always times out.tcpdump shows a successful TCP Handshakeand after the timeout (eg 10s)I can see the TCP FIN "handshake" But I do NOT see any actual packages transmitted. any ideas? EDIT: hmm odd. I can edit this post, but not the other one. well after a bit of investigating I came to the conclusion, that while a socket:connect() works (tcp handshake and so on) nothing happens with a socket:send('some data') it just times out. So the problem is not related to the http.lua module. but already at the lowerlevel tcp module. Edited June 14, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 16, 2016 Author Share Posted June 16, 2016 Currently trying it with the dynamic_lua qagame.but I get the following: PANIC: unprotected error in call to Lua API (core and library have incompatible numeric types) I am using the lib from: http://packages.ubuntu.com/xenial/i386/liblua5.3-0 Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted June 16, 2016 Management Share Posted June 16, 2016 I think we need to refer to TheSilencerPL with this problem. But just to clarify, do you get that error by only running some "Hello World" test script or does it appear when you load more functionalities from additional libraries? Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 16, 2016 Author Share Posted June 16, 2016 (edited) I'll get that panic before any lua module gets loaded. log: https://ptpb.pw/xB9r ET Legacy v2.74-507-gdc7379e linux-i386 Jan 4 2016Zone megs: 24----- FS_Startup -----Current search path:/home/gs/wolfet/.testserver/testsilent/home/gs/wolfet/testsilent/home/gs/wolfet/testsilent/testsilent-0.9.0.pk3 (528 files)/home/gs/wolfet/.testserver/etmain/home/gs/wolfet/.testserver/etmain/warbell.pk3 (242 files)/home/gs/wolfet/.testserver/etmain/venice.pk3 (330 files)/home/gs/wolfet/.testserver/etmain/trmfght_beta2.pk3 (197 files)/home/gs/wolfet/.testserver/etmain/tc_base.pk3 (63 files)/home/gs/wolfet/.testserver/etmain/sw_oasis_b3.pk3 (45 files)/home/gs/wolfet/.testserver/etmain/supplydepot2.pk3 (46 files)/home/gs/wolfet/.testserver/etmain/sp_delivery_te.pk3 (51 files)/home/gs/wolfet/.testserver/etmain/reactor_final.pk3 (115 files)/home/gs/wolfet/.testserver/etmain/pirates.pk3 (154 files)/home/gs/wolfet/.testserver/etmain/parisbastille_b3.pk3 (116 files)/home/gs/wolfet/.testserver/etmain/mlb_temple.pk3 (83 files)/home/gs/wolfet/.testserver/etmain/missile_b4.pk3 (89 files)/home/gs/wolfet/.testserver/etmain/karsiah_te2.pk3 (41 files)/home/gs/wolfet/.testserver/etmain/italyfp2.pk3 (325 files)/home/gs/wolfet/.testserver/etmain/goldrush-ga.pk3 (36 files)/home/gs/wolfet/.testserver/etmain/frostbite.pk3 (99 files)/home/gs/wolfet/.testserver/etmain/Fata_Morgana.pk3 (73 files)/home/gs/wolfet/.testserver/etmain/et_mor2_night_final.pk3 (92 files)/home/gs/wolfet/.testserver/etmain/et_ice.pk3 (61 files)/home/gs/wolfet/.testserver/etmain/et_carentan_b2.pk3 (130 files)/home/gs/wolfet/.testserver/etmain/et_beach.pk3 (177 files)/home/gs/wolfet/.testserver/etmain/erdenberg_t1.pk3 (77 files)/home/gs/wolfet/.testserver/etmain/element_skye.pk3 (27 files)/home/gs/wolfet/.testserver/etmain/dubrovnik_final.pk3 (186 files)/home/gs/wolfet/.testserver/etmain/caen2.pk3 (83 files)/home/gs/wolfet/.testserver/etmain/bremen_final.pk3 (100 files)/home/gs/wolfet/.testserver/etmain/braundorf_final.pk3 (76 files)/home/gs/wolfet/.testserver/etmain/bergen.pk3 (181 files)/home/gs/wolfet/.testserver/etmain/baserace_desert.pk3 (154 files)/home/gs/wolfet/.testserver/etmain/axislab_final.pk3 (172 files)/home/gs/wolfet/.testserver/etmain/adlernest_2.pk3 (120 files)/home/gs/wolfet/etmain/home/gs/wolfet/etmain/pak0.pk3 (3725 files)----------------------7994 files in pk3 filesexecing default.cfgcouldn't exec autoexec.cfgHunk_Clear: reset the hunk okNot logging server attacks to disk.Found high quality video and fast CPUSQLite3 libversion 3.9.2 - database URL 'etl.db' - in-memory... reading existing database '/home/gs/wolfet/.testserver/etl.db'... database file '/home/gs/wolfet/.testserver/etl.db' loadedSQLite3 ET: L database '/home/gs/wolfet/.testserver/etl.db' init--- Common Initialization Complete ---IP: 127.0.0.1IP: 94.23.7.172IP: 10.8.0.1Opening IP socket: 0.0.0.0:13337Network initialized.execing testserver.cfgsv_maxclients will be changed upon restarting.g_gametype will be changed upon restarting.execing mapvote.cfg------ Server Initialization ------Server: sw_oasis_b3Hunk_Clear: reset the hunk ok...IRC: connecting to server irc.quakenet.org----- FS_Startup -----...Connected to IRC serverCurrent search path:/home/gs/wolfet/.testserver/testsilent/home/gs/wolfet/testsilent/home/gs/wolfet/testsilent/testsilent-0.9.0.pk3 (528 files)/home/gs/wolfet/.testserver/etmain/home/gs/wolfet/.testserver/etmain/warbell.pk3 (242 files)/home/gs/wolfet/.testserver/etmain/venice.pk3 (330 files)/home/gs/wolfet/.testserver/etmain/trmfght_beta2.pk3 (197 files)/home/gs/wolfet/.testserver/etmain/tc_base.pk3 (63 files)/home/gs/wolfet/.testserver/etmain/sw_oasis_b3.pk3 (45 files)/home/gs/wolfet/.testserver/etmain/supplydepot2.pk3 (46 files)/home/gs/wolfet/.testserver/etmain/sp_delivery_te.pk3 (51 files)/home/gs/wolfet/.testserver/etmain/reactor_final.pk3 (115 files)/home/gs/wolfet/.testserver/etmain/pirates.pk3 (154 files)/home/gs/wolfet/.testserver/etmain/parisbastille_b3.pk3 (116 files)/home/gs/wolfet/.testserver/etmain/mlb_temple.pk3 (83 files)/home/gs/wolfet/.testserver/etmain/missile_b4.pk3 (89 files)/home/gs/wolfet/.testserver/etmain/karsiah_te2.pk3 (41 files)/home/gs/wolfet/.testserver/etmain/italyfp2.pk3 (325 files)/home/gs/wolfet/.testserver/etmain/goldrush-ga.pk3 (36 files)/home/gs/wolfet/.testserver/etmain/frostbite.pk3 (99 files)/home/gs/wolfet/.testserver/etmain/Fata_Morgana.pk3 (73 files)/home/gs/wolfet/.testserver/etmain/et_mor2_night_final.pk3 (92 files)/home/gs/wolfet/.testserver/etmain/et_ice.pk3 (61 files)/home/gs/wolfet/.testserver/etmain/et_carentan_b2.pk3 (130 files)/home/gs/wolfet/.testserver/etmain/et_beach.pk3 (177 files)/home/gs/wolfet/.testserver/etmain/erdenberg_t1.pk3 (77 files)/home/gs/wolfet/.testserver/etmain/element_skye.pk3 (27 files)/home/gs/wolfet/.testserver/etmain/dubrovnik_final.pk3 (186 files)/home/gs/wolfet/.testserver/etmain/caen2.pk3 (83 files)/home/gs/wolfet/.testserver/etmain/bremen_final.pk3 (100 files)/home/gs/wolfet/.testserver/etmain/braundorf_final.pk3 (76 files)/home/gs/wolfet/.testserver/etmain/bergen.pk3 (181 files)/home/gs/wolfet/.testserver/etmain/baserace_desert.pk3 (154 files)/home/gs/wolfet/.testserver/etmain/axislab_final.pk3 (172 files)/home/gs/wolfet/.testserver/etmain/adlernest_2.pk3 (120 files)/home/gs/wolfet/etmain/home/gs/wolfet/etmain/pak0.pk3 (3725 files)----------------------7994 files in pk3 filesSys_LoadDll(/home/gs/wolfet/.testserver/testsilent/qagame.mp.i386.so)... failed: "/home/gs/wolfet/.testserver/testsilent/qagame.mp.i386.so: cannot openshared object file: No such file or directory"Sys_LoadDll(/home/gs/wolfet/testsilent/qagame.mp.i386.so)... succeededSys_LoadDll(testsilent/qagame) found vmMain function at 0xe8f26d80------- Game Initialization -------gamename: silEnTgamedate: Nov 22 2015*=====Server Installation Check* Inspecting menu filesMenu files are Ok* Inspecting assetsAsset files are Ok* Inspecting server cvars*=====Server Installation Checked and Found Ok424 cvars in use.*===== SCREENSHOTS IN USEfile not found: scripts/our.campaign------------------------------------------------------------InitGame: \sv_sac\1\omnibot_playing\0\mod_url\http://mygamingtalk.com/\mod_version\0.9.0\g_axismaxlives\0\g_alliedmaxlives\0\g_maxlivesRespawnPenalty\0\voteFlags\0\g_balancedteams\0\g_maxGameClients\0\g_bluelimbotime\20000\g_redlimbotime\30000\gamename\silEnT\g_tyranny\1\g_damageXPLevel\70\g_damageXP\2\g_maxConnsPerIP\4\g_heavyWeaponRestriction\100\g_antilagDelay\0\omnibot_enable\0\g_antilag\1\g_voteFlags\0\g_minGameClients\0\g_needpass\0\g_maxlives\0\g_friendlyFire\0\sv_floodProtect\1\sv_maxPing\0\sv_minPing\0\sv_dlRate\100\sv_maxRate\50000\sv_maxclients\34\sv_minRate\0\sv_hostname\sKy-e.Beginners XPSave\sv_privateClients\2\mapname\sw_oasis_b3\protocol\82\g_gametype\6\timelimit\0\version\ET 2.60b linux-i386 May 8 2006Start of warmup.Cheat logfile open: cheat.logreadconfig: loaded 17 levels, 420 bans, 85 subnet bans, 61 commands, 0 warnings and 1 custom votesLoading Dynamic Server Modules* Could not load module configuration file "modules.cfg".Execing default.cfg mapconfig for 0 players.* Execing commands for player amount between 0 - 12.* Execed total of 24 commands from the config file.Execing sw_oasis_b3.cfg mapconfig for 0 players.* Config file "mapconfigs/sw_oasis_b3.cfg" was not found.Gametype changed, clearing session data.serverstats: loaded 45 mapstatsbanners: loaded 6 banners*=====INITIALISING USER DATABASE* Opening user database file userdb.db.* Opening user database file userxdb.db.* User database files open. Caching database.1 players cached from the user database.No additional user records in the user database.* Reading aliases database.Read total of 1 aliases for 1 players.*=====DATABASE READY FOR USEEnable spawning!Disable spawning!1 teams with 1 entities-----------------------------------Setting MOTD...Disabling sv_floodprotect]PANIC: unprotected error in call to Lua API (core and library have incompatible numeric types)----- Server Shutdown -----Resolving etmaster.idsoftware.com (IPv4)etmaster.idsoftware.com resolved to 192.246.40.60:27950Sending heartbeat to etmaster.idsoftware.comResolving master.etlegacy.com (IPv4)master.etlegacy.com resolved to 5.135.27.11:27950Sending heartbeat to master.etlegacy.comResolving master0.etmaster.net (IPv4)master0.etmaster.net resolved to 91.220.53.121:27950Sending heartbeat to master0.etmaster.net=== ShutdownGame -------------------------------------------*=====CLOSING DATABASEBuffers cleaned.Big Memory Cache cleaned.*=====DATABASE IS CLOSEDUnloading Dynamic Server ModulesDynamic Server Modules UnloadedShutdownGame: done. Closing log.---------------------------------------------------------------------------------------Sys_Exit warning - PID file doesn't exist /home/gs/wolfet/.testserver/testsilent/etlegacy_server.pidNetwork shutdown. Edited June 16, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
Management TheSilencerPL Posted June 16, 2016 Management Share Posted June 16, 2016 silEnT mod is linked against lua 5.3.1 as far as I remember, and you are using 5.3.0 if I am correct - that might be the cause. Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 16, 2016 Author Share Posted June 16, 2016 (edited) I am using 5.3.3 I'll try with 5.3.1 edit: same with 5.3.1 Edited June 16, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 17, 2016 Author Share Posted June 17, 2016 http://www.lua.org/manual/5.3/manual.html#luaL_checkversion since this is the call which raises the error, I assume, the lua versions are NOT the same. Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted June 17, 2016 Management Share Posted June 17, 2016 The liblua you have is compiled as 32 bit binary with 32 bit integers? Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 17, 2016 Author Share Posted June 17, 2016 (edited) yes. I have compiled it in a 32 chroot. gs@server1 ~/wolfet % file /usr/lib/i386-linux-gnu/liblua.so.5.3 /usr/lib/i386-linux-gnu/liblua.so.5.3: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=e7f186a10367b9209c168d910c84ed19199f6c40, not stripped Full ELF info: https://ptpb.pw/KWmf Edited June 17, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted June 18, 2016 Management Share Posted June 18, 2016 // silencer // LUA_32BITS to get 32-bit integers and 'float' and // LUA_C89_NUMBERS to get 'long' and 'double, which was the traditional // combination before 5.3. /* @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You ** can also define LUA_32BITS in the make file, but changing here you ** ensure that all software connected to Lua will be compiled with the ** same configuration. */ #define LUA_32BITS /* @@ LUA_USE_C89 controls the use of non-ISO-C89 features. ** Define it if you want Lua to avoid the use of a few C99 features ** or Windows-specific features on Windows. */ #define LUA_USE_C89 We have these defined at the top of the luaconf.h. Maybe you need them too. Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 18, 2016 Author Share Posted June 18, 2016 (edited) that seemed to be working. Lua 5.3.1 with -DLUA_32BITS -DLUA_USE_C89 still cant send stuff over a socket though Edited June 18, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 18, 2016 Author Share Posted June 18, 2016 made a short video which hopefully explains my issue: https://ptpb.pw/yV5R.webm Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 18, 2016 Author Share Posted June 18, 2016 Btw, luasockets work in the systemwide lua interpreter. (5.3.1 32bit) Lua 5.3.1 Copyright © 1994-2015 Lua.org, PUC-Rio> http = require'socket.http'> print(http.request('http://127.0.0.1'))Hi there 200 table: 0x80c1600 HTTP/1.1 200 OK /usr/bin/lua5.3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5c238fe30c288fab06fd2c3e25bbffb575a48700, stripped Quote Link to comment Share on other sites More sharing options...
Management TheSilencerPL Posted June 19, 2016 Management Share Posted June 19, 2016 I wonder if we need some flag in the lua to enable sockets, like LUA_SOCKET or something they have there maybe.Or just linking against the luasocket library, Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 19, 2016 Author Share Posted June 19, 2016 Curl works though. So sockets seem to be working. I tried lcurl which links against libcurl and it worked. I dont like the callback structure of curl though. So if anyone has a wrapper around that Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 22, 2016 Author Share Posted June 22, 2016 Does noone has any more ideas? Or maybe its not even a problem with luasockets but with my take on it. Can someone try and check if it works for you? Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 23, 2016 Author Share Posted June 23, 2016 Nvm. I got it working. Dunno what changed But I compiled luasocket again and now it works. odd Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 26, 2016 Author Share Posted June 26, 2016 So I got everything working now. One problem though, using luasocket http is blocking. Since I am using this in et_clientConnect (not always though) everytime I do the http request the server lags until the request has finished. I return nil or a string based on the result of the request. Is there any way I could make this callback nonblocking? (like let it execute for more than 1 server frame, the client has to wait for the result though)? Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted June 26, 2016 Management Share Posted June 26, 2016 I don't think so. The mod and the Lua execute in the same thread. So the et_clientConnect must return for the game to continue and the return value is also used by the game. If you can find a way to create threads within the Lua and have a separate thread for the networking, you might get by with less lags. Of course, you still have synchronization issues. Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 27, 2016 Author Share Posted June 27, 2016 (edited) having threads in lua should not be a problem, since u can just bind a C module anyway. But I would like to return a ~= nil value based on the result of the request in the et_ClientConnect callback. how would I do that? I mean even if I fork the networking into a seperate thread, the function would still have to wait for that thread to finish, so I could return sth. I almost think that this would not be possible. So probably just always return nil and then kick based on the result. Still, this could be done more beautifully like calling every callback in its own thread and collecting the return values in an array. when all callbacks are finished, iterate over the results instead of calling the callbacks in a loop. Edited June 27, 2016 by belstgut Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted June 27, 2016 Management Share Posted June 27, 2016 The return value is used by the game so the game is stuck waiting for it in every case. Adding threading is not something that should be ever done lightly, without considering if there is something wrong in the design that can be fixed to avoid adding threads, especially in this case when it wouldn't change anything in the game. I don't remember, but probably there is only one callback made on client connect, so there aren't even parallel callbacks to be made. On the other hand, you can kick players at any time using Lua. Quote Link to comment Share on other sites More sharing options...
belstgut Posted June 27, 2016 Author Share Posted June 27, 2016 sure there are more callbacks. I mean every lua script which has the et_ClientConnect function gets called when a player connects. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.