Server crash on SP loading

General discussion for off-topic subjects.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Server crash on SP loading

Postby Hedgehog » Wed Aug 27, 2014 6:01 pm

I have CSS test server at gameservers.com and when I try to load SourcePython it crashes.
Server console:

Code: Select all

Console initialized.
Setting breakpad minidump AppID = 240
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Loaded 1335 VPK file hashes from /usr/local/games/css/----/css/cstrike/cstrike_pak.vpk for pure server operation.
Loaded 1335 VPK file hashes from /usr/local/games/css/----/css/cstrike/cstrike_pak.vpk for pure server operation.
Loaded 1218 VPK file hashes from /usr/local/games/css/----/css/hl2/hl2_textures.vpk for pure server operation.
Loaded 574 VPK file hashes from /usr/local/games/css/----/css/hl2/hl2_sound_vo_english.vpk for pure server operation.
Loaded 383 VPK file hashes from /usr/local/games/css/----/css/hl2/hl2_sound_misc.vpk for pure server operation.
Loaded 434 VPK file hashes from /usr/local/games/css/----/css/hl2/hl2_misc.vpk for pure server operation.
Loaded 5 VPK file hashes from /usr/local/games/css/----/css/platform/platform_misc.vpk for pure server operation.
server_srv.so loaded for "Counter-Strike: Source"
[Source.Python] Loading...
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
PreMinidumpCallback: updating dump comment
Uploading dump (out-of-process) [proxy '']
/tmp/dumps/crash_20140827174601_1.dmp


CSS, linux, July 17 build
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Thu Aug 28, 2014 4:38 am

Yeah, I'm aware of this issue. This is due to the fact they are using "<ip>:<port>" in their paths so it confuses Python. I made some testing few months ago and I didn't find a solution. I think we could use a symbolic link to move the path prior the colon. Unfortunately, my test server expired there so I could not say when I will be able to test it out. At least, they finally updated their libraries from 2.4 to 2.7+.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sun Aug 31, 2014 11:55 am

I was able to bypass this problem (I'll post the solution later), using symlink hack, but I faced another one:

Code: Select all

[Source.Python] Loading...
Traceback (most recent call last):
  File "/usr/local/games/css/----/css/cstrike/addons/source-python/packages/source-python/__init__.py", line 41, in <module>
    from hooks.exceptions import except_hooks
  File "/usr/local/games/css/----/css/cstrike/addons/source-python/packages/source-python/hooks/__init__.py", line 10, in <module>
    from loggers import _sp_logger
  File "/usr/local/games/css/----/css/cstrike/addons/source-python/packages/source-python/loggers.py", line 10, in <module>
    from datetime import date
  File "/usr/local/games/css/----/css/cstrike/addons/source-python/Python3/datetime.py", line 7, in <module>
    import time as _time
ImportError: /home/glibc215/lib/libc.so.6: version `GLIBC_2.17' not found (required by /usr/local/games/css/----/css/cstrike/addons/source-python/Python3/lib-dynload/time.cpython-34m.so)
[Source.Python] Failed to load.
[Source.Python] Could not initialize python.
Failed to load plugin "addons/source-python"

(No crash)
How to fix this?
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun Aug 31, 2014 11:58 am

You need to ask them to update their libraries - I though they did it but apparently not.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sun Aug 31, 2014 12:03 pm

L'In20Cible wrote:You need to ask them to update their libraries - I though they did it but apparently not.

Ok, I will ask them. But if they say no, will it be possible to recomple time.cpython-34m.so with old glibc?
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun Aug 31, 2014 12:10 pm

Create a ticket, they will update them for you.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sun Aug 31, 2014 4:05 pm

Changes that I made to fix crashes caused by colon symbol in the server path.

I'm to C/C++ developer and I had only half year course in my university 3 years ago... So my code probably isn't very good :)

Function that generates a symlink.

Code: Select all

#if !defined(_WIN32)
//---------------------------------------------------------------------------------
// Purpose: Generate symlink without ':' (colon) symbol
//---------------------------------------------------------------------------------
void HedgehogGenSymlink(char *path)
{
   int pathLen = V_strlen(path);
   char symlinkOrigin[pathLen];
   char symlinkPath[pathLen];

   V_strncpy(symlinkOrigin, path, pathLen);
   V_strncpy(symlinkPath, path, pathLen);

   int i = 0;
   bool flag = false;

   for (i = 0; i < pathLen; i++)
   {
      if (path[i] == ':')
      {
         path[i] = '-';
         symlinkPath[i] = '-';
         flag = true;
      }
      if (flag && path[i] == '/')
      {
         break;
      }
   }
   symlinkOrigin[i] = '\0';
   symlinkPath[i] = '\0';

   symlink(symlinkOrigin, symlinkPath);
}
#endif


src/loader/loader_main.cpp
on line 175 after

Code: Select all

engine->GetGameDir(szGameDir, 1024);

add:

Code: Select all

#if !defined(_WIN32)
   // Fix up colon symbol in server path
   while (strchr(szGameDir, ':') != NULL)
   {
      HedgehogGenSymlink(szGameDir);
   }
#endif

on line 84 after

Code: Select all

engine->GetGameDir(szGamePath, 1024);

add:

Code: Select all

#if !defined(_WIN32)
   // Fix up colon symbol in server path
   while (strchr(szGamePath, ':') != NULL)
   {
      HedgehogGenSymlink(szGamePath);
   }
#endif

src/core/sp_gamedir.cpp
after (line 55)

Code: Select all

engine->GetGameDir(m_szGameDir, MAX_GAME_PATH);

add:

Code: Select all

#if !defined(_WIN32)
   // Fix up colon symbol in server path
   while (strchr(m_szGameDir, ':') != NULL)
   {
      HedgehogGenSymlink(m_szGameDir);
   }
#endif


It looks like it works correctly on my local Ubuntu server.
I think Source.Python Developers can somehow implement it in official version :)
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sun Aug 31, 2014 6:36 pm

But I think it's impossible to update glibc for only one gameserver...

EDIT: Yep...
This is not possible. GLIBC updates can (and often do) break other things on the machine. We must be on 2.5, and we have available (via special link) 2.15.

2.17 is not currently available. You will need to have an addon that is compatible with an older version of glibc in order to function. Once you have this, let us know and we can set you up with the glibc 2.15 link.
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Mon Sep 01, 2014 2:00 am

Well...

Code: Select all

Dear Customer,
 
Ticket PPS-464MU has been updated by Keith Wolenuk [staff].
 
I have changed the glibc library for the server, but now it crashes at startup with the mod enabled.
 
Thank You,
Keith Wolenuk
GameServers.com
 
To update or check the progress of your ticket, please login to https://my.gameservers.com and access your account.
 
~ The GameServers.com Team ~
      Frag. Not Lag.
And yes, this is something like this I was thinking about symbolic links, glad you got it working and confirmed it works!
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Mon Sep 01, 2014 4:56 pm

I asked them about your ticket, but:
Hello,

In this ticket, you were provided:

OSError: /lib/libc.so.6: version `GLIBC_2.7'

Glibc 2.15 is actually a higher revision than 2.7. (2.9 goes to 2.10, etc).

We are not able to provide 2.17, only 2.15 (which is compatible with 2.15 and below versions).

We can not provide you with a higher level at this time.

Thanks,

Zachary Williams
http://www.gameservers.com/
Frag. Not Lag.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Wed Sep 03, 2014 4:06 am

Ok, I recompiled Python 3.4.1 o Debian 7.6 with glibc 2.13 and replaced time.cpython-34m.so to the new one, so the problem was solved. But very soon I got another one. I was trying to load plugin that uses sqlite but another error was rised:
"ImportError: libsqlite3.so.0: cannot open shared object file: No such file or directory "
GS support fixed it by putting libsqlite3.so to the servers bin directory (ES has similar problem). But it wasn't the end of my adventure...
sp_test plugin: (1 line only)
[PYTHON]import sqlite3[/PYTHON]
An error:

Code: Select all

[SP] Loading plugin 'sp_test'...
 
[SP] Caught an Exception:
Traceback (most recent call last):
  File '../addons/source-python/packages/source-python/plugins/manager.py', line 72, in __missing__
    instance = self.instance(plugin_name, self.base_import)
  File '../addons/source-python/packages/source-python/plugins/instance.py', line 82, in __init__
    self._plugin = import_module(import_name)
  File '../addons/source-python/plugins/sp_test/sp_test.py', line 1, in <module>
    import sqlite3
  File '../addons/source-python/Python3/sqlite3/__init__.py', line 23, in <module>
    from sqlite3.dbapi2 import *
  File '../addons/source-python/Python3/sqlite3/dbapi2.py', line 26, in <module>
    from _sqlite3 import *
 
ImportError: ../addons/source-python/Python3/lib-dynload/_sqlite3.cpython-34m.so: undefined symbol: sqlite3_open_v2
 
 
[SP] Plugin 'sp_test' was unable to be loaded.

What can I do to fix it?

I'm startng to hate GS...
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Wed Sep 03, 2014 7:54 pm

OMG, I was able to fix this error also and now everything (almost everything* :mad: :mad :) work perfectly!

GS support used an old version of libsqlite3.so.0 which was given as a solution for the same ES problem, so I just replaced it to the newer one form Debian 7.6.0 (it can be found in /usr/lib/i386-linux-gnu/libsqlite3.so.0.8.6): https://dl.dropboxusercontent.com/u/2375363/libsqlite3.so.0.8.6.tar.gz

Just put it in bin directory, NOT IN cstrike/bin :)

Also, it looks like another solution from here (Fix #1) is working: (put libsqlite3.so.0 in libfix plugin directory)

Syntax: Select all

import ctypes

from paths import PLUGIN_PATH

lib = None

def load():
global lib
lib = ctypes.cdll.LoadLibrary(PLUGIN_PATH.joinpath("libfix", "libsqlite3.so.0"))


By the way, what is the difference between calling something in load() function or just in the code? Ex:

Syntax: Select all

import ctypes

from paths import PLUGIN_PATH

ctypes.cdll.LoadLibrary(PLUGIN_PATH.joinpath("libfix", "libsqlite3.so.0"))


*- one of my plugins crash server on load, but I think that it happens because of my mistake somewhere in the code. I'll look in it tomorrow or the day after tomorrow...
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Postby Tuck » Thu Sep 04, 2014 6:00 pm

Load() will be called everytime the script "loads", code written outside. Will just be executed once, and not upon reloads.


edit: my bad though something else about the script manager
-Tuck
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Thu Sep 04, 2014 6:09 pm

Actually that's not true. The whole script is reloaded!

It's just the complement for the unload() function.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Thu Sep 04, 2014 6:19 pm

Ayuto wrote:Actually that's not true. The whole script is reloaded!

It's just the complement for the unload() function.
So basically there are no difference between writing code in load function and writing it outside, right?
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Thu Sep 04, 2014 6:36 pm

Yes, the only difference is that the code outside is executed at first. After that the load() function is executed.
User avatar
satoon101
Project Leader
Posts: 2698
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Sep 04, 2014 7:27 pm

And, any variables created outside of load are global variables, whereas you would need to use the global keyword to achieve the same in the load function.

Return to “Whatever”

Who is online

Users browsing this forum: No registered users and 3 guests