2020-08-13 08:14 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0006300AIAIpublic2019-09-10 20:24
Assigned To 
Summary0006300: Java AI interface sometimes throws "does not implement" error on startup
Description[f=-000001] [EOH::CreateSkirmishAI(id=0)]
[f=-000001] [AIWrapper::PreInit][AI=0 team=0] creating callbacks
[f=-000001] [Java Interface] JRE found in registry!
[f=-000001] [Java Interface] Using JRE (can be changed with JAVA_HOME): C:\Program Files (x86)\Java\jre1.8.0_221
[f=-000001] [Java Interface] Successfully loaded the JVM shared library at "C:\Program Files (x86)\Java\jre1.8.0_221\bin\client\jvm.dll".
[f=-000001] [Java Interface] Initialization successful.
java.lang.IncompatibleClassChangeError: Class [F does not implement the requested interface com.springrts.ai.AICallback
    at com.springrts.ai.oo.clb.WrappGame.getMyTeam(WrappGame.java:64)
    at zkgbai.ZKGraphBasedAI.init(ZKGraphBasedAI.java:77)
    at com.springrts.ai.oo.OOAI.init(OOAI.java:39)
[f=-000001] Warning: AI for team 0 (ID: 0) failed handling event with topic 1, error: -5
[f=-000001] Error: [AIWrapper::SendInitEvent][AI=0 team=0] error -5 handling EVENT_INIT
[f=-000001] [~ScopedOnceTimer][Game::LoadSkirmishAIs::CreateAI(id=0)] 82ms
Steps To ReproduceRun a java AI on random maps until it fails to load.
Additional InformationIf it were happening consistently I'd say it was my fault, like using the wrong interface version or something, but it's very inconsistent. Once it fails to load the first time either spring crashes or it fails to load every time thereafter. Usually it works normally though.
TagsNo tags attached.
Attached Files

related to 0005952new Spring engine Java AIs are not killed on Spring.Reload 



abma (administrator)

hm, weird that it doesn't always fail, so the hint from https://stackoverflow.com/questions/1980452/what-causes-java-lang-incompatibleclasschangeerror to recompile isn't useful i guess.

can you post a complete infolog.txt with the error please?

i.e. the used spring version is useful.

even your used jdk version is very similar to the version of used on the buildslave:
-> vs

did you get the error sometimes the first time an ai is loaded or is it always when reloading, i.e >=2 times when loading?

maybe just some mem/resource leak.


abma (administrator)

-> instructions how to reproduce would be useful

which engine version?
where to get the used ai?
which game?


aeonios (reporter)

I recompile many times a day. :|

infolog: https://pastebin.com/SjFmpkxk (spring also crashed after ending the game)
the ai: https://github.com/Anarchid/zkgbai (available through the 'releases' tab)

Usually it's when loading 2+ times. I don't know if it ever occurs the first time or not, but I don't recall seeing it crash on first load.

It may be from spring not killing the jvm after it unloads the AIs, which might be due to running chobby. The jvm really shouldn't be running if it isn't doing anything, and there's not much I can do in the AI to kill memory after the AI is supposed to be shut down. If I call System.exit(0) it also shuts down spring when the player may still be in the game looking at stats or something.


abma (administrator)

without investigating looks a bit like a feature request. the java ai interface seems to not support reload.

the function to destroy/unload jvm seems there:

but the message "JVM: Successfully destroyed" is missing in infolog.txt


aeonios (reporter)


// never destroy the JVM because then it can not be created again
// in the same thread; will always fail with return value -1 (see
// java_getJNIEnv)

Perhaps relevant? I'm not sure what it's actually doing though, if it's not killing the JVM when it's done. Whatever it is it seems crash prone.


abma (administrator)

yeah, it seems it doesn't get killed for reason. maybe that issue is gone because of some fix in the jvm itself.

atm it looks like it is always reinstantiated: maybe the code has just to be changed to reuse the existing jvm.


abma (administrator)

very likely also related to 0002189


aeonios (reporter)

I dunno about that, although spring crashing with java AIs is a very old issue.

-Issue History
Date Modified Username Field Change
2019-09-08 02:31 aeonios New Issue
2019-09-09 12:35 abma Note Added: 0020132
2019-09-09 12:35 abma Status new => feedback
2019-09-09 12:36 abma Note Added: 0020133
2019-09-10 01:00 aeonios Note Added: 0020136
2019-09-10 01:00 aeonios Status feedback => new
2019-09-10 09:44 abma Note Added: 0020137
2019-09-10 10:54 aeonios Note Added: 0020138
2019-09-10 11:25 abma Note Added: 0020139
2019-09-10 11:30 abma Relationship added related to 0005952
2019-09-10 11:32 abma Note Added: 0020140
2019-09-10 20:24 aeonios Note Added: 0020142
+Issue History