steamworks4j icon indicating copy to clipboard operation
steamworks4j copied to clipboard

Crash on Steamworks4j-1.9.0 after attempting to use SteamUGC.createItem

Open Daburnell112 opened this issue 2 years ago • 2 comments

Attempting to write a command line tool to upload a mod for a game on the Steam Workshop. The game is not yet purchasable on Steam and has not been approved for release, yet. Part of the approval process is to upload a single mod to the workshop.

This is the code I'm attempting to use: image

This is the error that is resulting:

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc12c4dbfc, pid=14040, tid=24240

JRE version: OpenJDK Runtime Environment Temurin-17.0.6+10 (17.0.6+10) (build 17.0.6+10) Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (17.0.6+10, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) Problematic frame: C [steamworks4j64.dll+0xdbfc]

No core dump will be written. Minidumps are not enabled by default on client versions of Windows

If you would like to submit a bug report, please visit: https://github.com/adoptium/adoptium-support/issues The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.

Stack/Thread frame information:

--------------- T H R E A D ---------------

Current thread (0x00000273f0ac72a0): JavaThread "main" [_thread_in_native, id=24240, stack(0x000000f692d00000,0x000000f692e00000)]

Stack: [0x000000f692d00000,0x000000f692e00000], sp=0x000000f692dfef00, free space=1019k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [steamworks4j64.dll+0xdbfc]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j com.codedisaster.steamworks.SteamUGCNative.createItem(JII)J+0 [email protected] j com.codedisaster.steamworks.SteamUGC.createItem(ILcom/codedisaster/steamworks/SteamRemoteStorage$WorkshopFileType;)Lcom/codedisaster/steamworks/SteamAPICall;+13 [email protected] j com.me.Sargon_Workshop_Tool.uc_workshop_tool.GetSteamWorkshopItemAppID(Lcom/me/Sargon_Workshop_Tool/uc_workshop_tool;Ljava/lang/String;)V+246 Sargon_Workshop_Tool j com.me.Sargon_Workshop_Tool.uc_workshop_tool.Intialize(Lcom/me/Sargon_Workshop_Tool/uc_workshop_tool;)V+85 Sargon_Workshop_Tool j com.me.Sargon_Workshop_Tool.uc_workshop_tool.main([Ljava/lang/String;)V+249 Sargon_Workshop_Tool v ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000

Example JVM crash log is attached.

hs_err_pid8744.log

Daburnell112 avatar Sep 05 '23 21:09 Daburnell112

That's an odd place for a crash. Note that even for command-line tools, you still need to do the full init()/runCallback()/shutdown() cycle. For example, this is how it looks like in our tool:

        SteamAPI.init();
        SteamAPI.printDebugInfo(System.out);

        ugc = new SteamUGC(ugcCallback);

        utils = new SteamUtils(utilsCallback);
        utils.setWarningMessageHook((severity, message) -> LOG.warn("({}) {}", severity, message));

        if (config.publishedFileID == 0) {
            // kick off the item creation process
            ugc.createItem(CONSUMER_APPID, WorkshopFileType.Community);
        } else {
            // update an existing item
            submitItemUpdate(new SteamPublishedFileID(config.publishedFileID), true);
        }

        while (!DONE) {
            SteamAPI.runCallbacks();
            try {
                Threads.sleep(250, 0);
            } catch (InterruptedException e) {
                throw new SteamException(e);
            }
        }

        ugc.dispose();
        utils.dispose();

        SteamAPI.shutdown();

Any more logic is done inside the callbacks, and that DONE flag is raised at the end of everything.

code-disaster avatar Sep 06 '23 07:09 code-disaster

i might have the exact same issue ... has this ever been sorted out?

this is from my console output:

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffaa6ac1764, pid=21172, tid=6680

JRE version: OpenJDK Runtime Environment Temurin-17.0.8+7 (17.0.8+7) (build 17.0.8+7) Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (17.0.8+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) Problematic frame: _C [steamworks4j64.dll+0x11764]:

No core dump will be written. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as: C:\Users\micro\processing-4.3\hs_err_pid21172.log

If you would like to submit a bug report, please visit: https://github.com/adoptium/adoptium-support/issues The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.

when calling the api like so (please excuse the messy code!! i'm in the fiddling around phase of it...)

try {
    SteamAPI.loadLibraries(dataPath("steam"));
    //SteamAPI.loadLibraries();

    
    // Prevent app restart if necessary
    //if (SteamAPI.restartAppIfNecessary(2873990)) {
    //  System.out.println("Restarting app for Steam.");
    //  return;
    //}
    
    
    Thread.sleep(500);
    
    println("calling init");
    if ( SteamAPI.init() ) {
      println("steam init success");
      SteamAPI.printDebugInfo(System.err);
      
    } else {
      println("steramworks init fail");
      SteamAPI.printDebugInfo(System.err);
    }
    
    Thread.sleep(500);

    println("calling isRunning");
    if ( SteamAPI.isSteamRunning(true) ) {
      println("running steam client detected");
    } else {
      println("no running steam client detected");
      exit();
    }
    
    Thread.sleep(500);
    
    
    println("init utils");
    clientUtils = new SteamUtils(clUtilsCallback);
    println("run callbacks");
    SteamAPI.runCallbacks();
    println("get sappid");
    int sappid = clientUtils.getAppID();
    
    println("SAPPID: " + sappid  );
    
    
    Thread.sleep(500);
            
    println("steam user stuff now");        
    
    SteamUser su = new SteamUser( new SteamUserCallbackImpl() );
    
    SteamAPI.runCallbacks();
    
    if( su != null ) {
      println("su: " + su);
      
      SteamID sid = su.getSteamID();
      if( sid != null ) {
        println("sid: " + sid);
        //println("steam user id: " + sid.getAccountID());
      } else {
        println("sid is null");
      }
    } else {
      println("su is null");
    }
    
    
  }
  catch (Exception e) {
    println("error while initializing steamworks API: " + e);
    // Error extracting or loading native libraries
  }

Krakentanz avatar Aug 02 '24 16:08 Krakentanz