Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.49.19.1+] BA Load from MUL (and loading savegames) Crashes -dedicated server #5539

Closed
mhjacks opened this issue Jun 1, 2024 · 10 comments
Closed

Comments

@mhjacks
Copy link
Contributor

mhjacks commented Jun 1, 2024

Environment

Dedicated server is 0.49.19.1 (or -SNAPSHOT) running on Linux (java 17.0.0.11)
Client running on Linux, also running java 17.0.0.11

I can also reproduce this with current SNAPSHOT as of May 22. It probably also repros with newer versions.

Description

When loading various kinds of BA units, the dedicated server throws an exception of approximately this form:

BA that has caused problems:

12:19:07,346 ERROR [megamek.MegaMek] {Connection 0}
megamek.MegaMek.lambda$main$0(MegaMek.java:63) - Uncaught Exception Detected
java.lang.ExceptionInInitializerError
    at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
    at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
    at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:42)
    at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:185)
    at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1132)
    at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1113)
    at java.base/java.lang.reflect.Field.getLong(Field.java:637)
    at java.base/java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1713)
    at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:396)
    at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:384)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at java.base/java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:384)
    at java.base/java.io.ObjectStreamClass$Caches$1.computeValue(ObjectStreamClass.java:110)
    at java.base/java.io.ObjectStreamClass$Caches$1.computeValue(ObjectStreamClass.java:107)
    at java.base/java.io.ClassCache$1.computeValue(ClassCache.java:73)
    at java.base/java.io.ClassCache$1.computeValue(ClassCache.java:70)
    at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
    at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
    at java.base/java.lang.ClassValue.get(ClassValue.java:116)
    at java.base/java.io.ClassCache.get(ClassCache.java:84)
    at java.base/java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:363)
    at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:579)
    at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2051)
    at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1898)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2224)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
    at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2157)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1721)
    at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
    at java.base/java.io.ObjectInputStream.readFields(ObjectInputStream.java:691)
    at java.base/java.util.Vector.readObject(Vector.java:1158)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1100)
    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2423)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
    at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2157)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1721)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
    at megamek.common.net.marshalling.NativeSerializationMarshaller.unmarshall(NativeSerializationMarshaller.java:43)
    at megamek.common.net.connections.AbstractConnection.processPacket(AbstractConnection.java:332)
    at megamek.common.net.connections.AbstractConnection.update(AbstractConnection.java:285)
    at megamek.server.ConnectionHandler.run(ConnectionHandler.java:47)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Hashtable.put(Object, Object)" because "megamek.common.EquipmentType.lookupHash" is null
    at megamek.common.EquipmentType.addLookupName(EquipmentType.java:713)
    at megamek.common.EquipmentType.setInternalName(EquipmentType.java:709)
    at megamek.common.equipment.ArmorType.createStandardArmor(ArmorType.java:315)
    at megamek.common.equipment.ArmorType.initializeTypes(ArmorType.java:79)
    at megamek.common.equipment.ArmorType.of(ArmorType.java:38)
    at megamek.common.EquipmentType.getArmorTypeName(EquipmentType.java:791)
    at megamek.common.BattleArmor.<clinit>(BattleArmor.java:186)
    ... 48 more

Full logfile also attached.

Files

megamek.log

@HammerGS
Copy link
Member

HammerGS commented Jun 1, 2024

A few errors in the log
Do you have a custom sound file replacing the bong?

12:18:05,119 ERROR [megamek.client.ui.swing.audio.SoundManager] {AWT-EventQueue-0}
megamek.client.ui.swing.audio.SoundManager.loadSoundClip(SoundManager.java:126) - SoundManager was unable to load the sound
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 22050.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.
	at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:484)
	at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectClip.implOpen(DirectAudioDevice.java:1241)
	at java.desktop/com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:115)
	at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectClip.open(DirectAudioDevice.java:1038)
	at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectClip.open(DirectAudioDevice.java:1134)
	at megamek.client.ui.swing.audio.SoundManager.loadSoundClip(SoundManager.java:122)
	at megamek.client.ui.swing.audio.SoundManager.loadSoundFiles(SoundManager.java:58)
	at megamek.client.ui.swing.ClientGUI.<init>(ClientGUI.java:365)
	at megamek.client.ui.swing.MegaMekGUI.getClientGUI(MegaMekGUI.java:498)
	at megamek.client.ui.swing.MegaMekGUI.startClient(MegaMekGUI.java:539)
	at megamek.client.ui.swing.MegaMekGUI.startClient(MegaMekGUI.java:519)
	at megamek.client.ui.swing.MegaMekGUI.connect(MegaMekGUI.java:892)
	at megamek.client.ui.swing.MegaMekGUI.lambda$new$0(MegaMekGUI.java:1034)
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Hashtable.put(Object, Object)" because "megamek.common.EquipmentType.lookupHash" is null
	at megamek.common.EquipmentType.addLookupName(EquipmentType.java:713)
	at megamek.common.EquipmentType.setInternalName(EquipmentType.java:709)
	at megamek.common.equipment.ArmorType.createStandardArmor(ArmorType.java:315)
	at megamek.common.equipment.ArmorType.initializeTypes(ArmorType.java:79)
	at megamek.common.equipment.ArmorType.of(ArmorType.java:38)
	at megamek.common.EquipmentType.getArmorTypeName(EquipmentType.java:791)
	at megamek.common.BattleArmor.<clinit>(BattleArmor.java:186)
	... 48 more

@mhjacks
Copy link
Contributor Author

mhjacks commented Jun 1, 2024

No, no custom sounds. I mute them.

Normally I run the dedicated server from a container I built. In the container, I don't see the sound errors. (For this repro, I'm running the -SNAPSHOT server on an off-port, not in the container)

@mhjacks
Copy link
Contributor Author

mhjacks commented Jun 1, 2024

The interesting thing (about the one that appears to be BA-related) is that I can inject BA units fine from the lobby using the UI. The error only occurs when loading from MUL or loading a savegame

@mhjacks
Copy link
Contributor Author

mhjacks commented Jun 3, 2024

I believe I can also replicate this with the latest tapenvyus/megamek server image (the beginning of the frame looks a litte different but the end looks quite similar):

22:17:38,499 ERROR [megamek.MegaMek] {Connection 0}
megamek.MegaMek.lambda$main$0(MegaMek.java:63) - Uncaught Exception Detected
java.lang.ExceptionInInitializerError
    at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
    at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
    at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:42)
    at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:185)
    at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1132)
    at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1113)
    at java.base/java.lang.reflect.Field.getLong(Field.java:637)
    at java.base/java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1713)
    at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:396)
    at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:384)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at java.base/java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:384)
    at java.base/java.io.ObjectStreamClass$Caches$1.computeValue(ObjectStreamClass.java:110)
    at java.base/java.io.ObjectStreamClass$Caches$1.computeValue(ObjectStreamClass.java:107)
    at java.base/java.io.ClassCache$1.computeValue(ClassCache.java:73)
    at java.base/java.io.ClassCache$1.computeValue(ClassCache.java:70)
    at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
    at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
    at java.base/java.lang.ClassValue.get(ClassValue.java:116)
    at java.base/java.io.ClassCache.get(ClassCache.java:84)
    at java.base/java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:363)
    at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:579)
    at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2051)
    at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1898)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2224)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
    at java.base/java.util.ArrayList.readObject(ArrayList.java:899)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1100)
    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2423)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
    at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2157)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1721)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
    at megamek.common.net.marshalling.NativeSerializationMarshaller.unmarshall(NativeSerializationMarshaller.java:43)
    at megamek.common.net.connections.AbstractConnection.processPacket(AbstractConnection.java:332)
    at megamek.common.net.connections.AbstractConnection.update(AbstractConnection.java:285)
    at megamek.server.ConnectionHandler.run(ConnectionHandler.java:47)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Hashtable.put(Object, Object)" because "megamek.common.EquipmentType.lookupHash" is null
    at megamek.common.EquipmentType.addLookupName(EquipmentType.java:713)
    at megamek.common.EquipmentType.setInternalName(EquipmentType.java:709)
    at megamek.common.equipment.ArmorType.createStandardArmor(ArmorType.java:315)
    at megamek.common.equipment.ArmorType.initializeTypes(ArmorType.java:79)
    at megamek.common.equipment.ArmorType.of(ArmorType.java:38)
    at megamek.common.EquipmentType.getArmorTypeName(EquipmentType.java:791)
    at megamek.common.BattleArmor.<clinit>(BattleArmor.java:183)
    ... 46 more

@RaozSpaz
Copy link

RaozSpaz commented Jun 4, 2024

A couple of dumb questions from me if you don't mind. But trying to check off a few relative bases.

1] What version of the game is the MUL saved from? Is it the exact same version/download.

2] You say you can add the BA using the UI to add units. When you add these units if you launch the game, do they function properly [attack and the like] without throwing any errors.

3] Is this solely a 49.19.1 error? Have you been able to replicate it on other versions?

@mhjacks
Copy link
Contributor Author

mhjacks commented Jun 4, 2024

Sure, makes sense. Thanks for looking into it!

To answer:

  1. Same version - 0.49.19.1. The server container is standalone megamek, the client version I use is the mekhq build. Other players in our group use the standalone megamek client, I believe.

  2. They did at least once. We discovered the issue when we started the game, it crashed, and couldn't re-load it from the autosave. Inside the game they seemed to behave normally.

  3. I've seen it in the latest development builds too (the log above is from a local test I did with dedicated server from a mekhq development build from 5/22 (I can build them myself; for the group games I use the builds provided on the github release site) running on an off-port. Our group routinely plays with battle armor, so this seems to be new in the 0.49.19.1 cycle. We certainly didn't notice it in any of the previous versions.

@RaozSpaz
Copy link

RaozSpaz commented Jun 4, 2024

  1. Then its definitely not an issue caused by different versions of MULs. That rules that out.

  2. Hmm. I was wondering if it was related to the other infantry issues but if they functioned properly i doubt that is it too.

  3. Im talking older builds. Can you get the error to replicate on 49.18 or 49.17? If not then that narrows it down to a 49.19 issue at least.

@mhjacks
Copy link
Contributor Author

mhjacks commented Jun 4, 2024

  1. Agreed.
  2. There might be something to that - if memory servers Princess stopped and that is why we had to load from save. That could have been a quiet NPE; we didn't think much of it at the time except the savegame wouldn't load on the dedicated server. Interestingly, it loads fine on a local game, and I was able to finish the game without issues.
  3. We usually jump to the new dev version the Saturday after it comes out. So it definitely was not present in 49.17 or 49.18, I don't know if we played on 49.19 enough to be completely sure about it.

On the plus side, the issue seems trivially reproducible from a Linux client with the tapenvy dedicated server image for 49.19.1.

@mhjacks
Copy link
Contributor Author

mhjacks commented Jun 5, 2024

@SJuliez I was able to build a local snapshot and your fix does indeed allow me to load units without issue:
image

@SJuliez
Copy link
Member

SJuliez commented Jun 6, 2024

Ah! Thanks :) In that case I can close this issue.

@SJuliez SJuliez closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants