question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessing "SteamNetworkingUtils003" before "SteamAPI_Init" succeeded error

See original GitHub issue

Describe the bug [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded.

Build version prints this error, but Unity editor doesn’t. It doesn’t break the server, but it makes it, so I can’t query rules from that server. I’ve tried building the newest release, but get errors about net46 (am on Linux). So I settled with https://github.com/Crytilis/Facepunch.Steamworks fork instead. It didn’t help.

Server is functioning, at least the basic query is. But the QueryRulesAsync() doesn’t give any results.

I have identified, that the error comes from “SteamServer.Init(AppId, serverInit);”, and it’s not “bool asyncCallbacks”.

It might be because the steamclient.so is wrong on both my PC and my VPS (tried it on both machines). Since I’m linking it usually from linux64/. Linking it, copying it, using 32bit instead (wrong elfclass error), didn’t fix it, neither did adding a steam_appid.txt.

I tried removing all other Steamworks functionality to see if I’m calling it somewhere I shouldn’t, but it also didn’t help.

Google didn’t help me either. So finally coming here.

Also my game is supposed to release in 1 week, so that’s fun.

To Reproduce Steps to reproduce the behavior:

  1. Start server with server-only build
  2. “Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded.” error
  3. Not being able to get server rules results from query

Calling Code

private IEnumerator StartServer()
{
    try
    {
        _isDedicatedServer = true;
        var serverInit = new SteamServerInit("TagHop", "TagHop");
        serverInit.GamePort = _gamePort;
        serverInit.Secure = true;
        serverInit.QueryPort = _queryPort;
        serverInit.SteamPort = 27016;
        serverInit.VersionString = _gameController.Version.ToStringSteam();//"0.1.3.0";
        SteamServer.Init(AppId, serverInit);//LINE THAT TRIGGERS THE ERROR
        SteamServer.ServerName = "Test Server";
        SteamServer.LogOnAnonymous();
    }
    catch (Exception e)
    {
        Log.Error("Failed making a steam server");
        Log.Exception(e);
    }

    if (!SteamServer.IsValid)
    {
        yield return new WaitForSeconds(1f);
        Log.Error("Steam server isn't valid");
    }
}

Desktop (please complete the following information):

  • OS: Arch Linux LTS
  • Unity 2020.3.25f1

Additional context Here’s the log (removed the redundant lines):

Preloaded ‘libsteam_api.so’ Initialize engine version: 2020.3.25f1 (9b9180224418) Begin MonoManager ReloadAssembly - Completed reload, in 0.066 seconds … UnloadTime: 0.497467 ms .… dlopen failed trying to load: steamclient.so with error: steamclient.so: cannot open shared object file: No such file or directory [S_API] SteamAPI_Init(): Loaded ‘/home/hostname/.local/share/Steam/linux64/steamclient.so’ OK. (First tried local ‘steamclient.so’) CAppInfoCacheReadFromDiskThread took 11 milliseconds to initialize Setting breakpad minidump AppID = 1625330 [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded. .… UnloadTime: 3.921835 ms Finished loading scene in server-only mode.

Unloading 78 unused Assets to reduce memory usage. Loaded Objects now: 4942. Total: 11.692430 ms (FindLiveObjects: 0.185797 ms CreateObjectMapping: 0.082222 ms MarkObjects: 11.256767 ms DeleteObjects: 0.167282 ms)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Chillu1commented, May 8, 2022

Hey, looks like you were having trouble opening the steamclient.so shared object, judging from the “steamclient.so: cannot open shared object file: No such file or directory” line. I fixed this by creating a symlink of steamclient.so from my steamcmd installation folder, in ~/.steam/sdk64/steamclient.so (because apparently that’s where the Steam API is looking for that particular file).

I did it like this (in my case, the user I’m installing starting the server under is called steam cause running steamcmd as root is a security risk):

ln -s /home/steam/steamcmd/linux64/steamclient.so /home/steam/.steam/sdk64/steamclient.so

Linking it, copying it, using 32bit instead (wrong elfclass error), didn’t fix it

0reactions
Chillu1commented, May 8, 2022

My memory is foggy, but I think I also might have gotten “Loaded local ‘steamclient.so’ OK.” before, and still got the same error.

Calling SteamServer.Init causes this Yeah: I have identified, that the error comes from “SteamServer.Init(AppId, serverInit);”, and it’s not "bool asyncCallbacks

What kind of crash is it? The one I get is that I can’t query for rules, and some additional extra logic.

The code hasn’t really changed since. The workaround doesn’t make the error go away, or fix the issue. It’s a way to get “rules”(extra info) without being able to query for them. I basically store all the data in SteamServer.ServerName instead.

private IEnumerator StartServer()
{
    try
    {
        _isDedicatedServer = true;
        var serverInit = new SteamServerInit("TagHop", "TagHop");
        serverInit.GameDescription = "TagHop";
        serverInit.GamePort = _gamePort;
        serverInit.Secure = true;
        serverInit.QueryPort = _queryPort;
        serverInit.SteamPort = 27016;
        serverInit.VersionString = _gameController.Version.ToStringSteam();
        SteamServer.Init(AppId, serverInit);

        if (File.Exists(Application.dataPath + "/serverconfig.txt"))
            SteamServer.ServerName = File.ReadAllText(Application.dataPath + "/serverconfig.txt");
        else
            SteamServer.ServerName = "Test_Server";

        _serverName = SteamServer.ServerName;
        SteamServer.LogOnAnonymous();
    }
    catch (Exception e)
    {
        Log.Error("Failed making a steam server");
        Log.Exception(e);
    }

    if (!SteamServer.IsValid)
    {
        yield return new WaitForSeconds(1f);
        Log.Error("Steam server isn't valid");
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't start Server anymore : r/unturned
[S_API FAIL] Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded. Setting up 2 worker threads for Enlighten.
Read more >
Incompatible version between client and dedicated server ...
... Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded. 09/01/2022 09:48:38: Server ID 90071992547409920 ...
Read more >
[Support] ich777 - Gameserver Dockers - Page 122
Error in Valhaim server log at startup? [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded.
Read more >
Couldn't initialize Steam Server - Rust - Community
Errors from Console before unloading all Plugins and Shutting down. This happens after iniatilizing entity save caches: dlopen failed trying ...
Read more >
SteamAPI_Init() failed; SteamAPI_IsSteamRunning() ...
Program seems to have some trouble in loading the steam library. After all the map generation and stuff, it tries to locate
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found