farin / JCloisterZone

Java implementation of Carcassonne board game
https://jcloisterzone.com
MIT License
305 stars 100 forks source link

Nullpointer, after undo #224

Closed max-wittig closed 7 years ago

max-wittig commented 7 years ago

Online game (2 players) Trying to undo previous move, after abbey proposal --> NullPointerException

Error Log: https://gist.github.com/max-wittig/98285c04f0eb8cc082cd3ba2e616520c

LojaRich commented 7 years ago

Has there been a fix for this, or no?

farin commented 7 years ago

Not yet, sorry.

LojaRich commented 7 years ago

This is very frustrating. My friends and I play Jcloisterzone almost every day, and the NullPoint error ruins the fun 40% of the time. We are even willing to donate, to help find a fix for this, but if the programmer is not interested, then we will just have to play the tabletop version instead. We really enjoyed all of the expansions Jcloisterzone offers, but the glitch is very annoying. Additionally, this week, a new error has occurred. Every time we open the .jar it is completely reset. The name field is blank and all of the options are unchecked, along with our presets being deleted. What is happening?? You guys have a great money-making opportunity. People would pay to play if it didn't have these errors. I am sure.

farin commented 7 years ago

I will try to look at this and also make new release (because there is some work in master which is currently not out) Don't forget this is my one man show free time "fun project". I love it but I am currently quite busy (family, new regular job) and It's hard to focus on JCZ now.

farin commented 7 years ago

just gist copy

[Thread-3] ERROR com.jcloisterzone.game.phase.ScorePhase - Method 'pass' called in invalid state
[Thread-3] ERROR com.jcloisterzone.game.phase.ScorePhase - Method 'pass' called in invalid state
[Thread-3] ERROR com.jcloisterzone.game.phase.ScorePhase - Method 'pass' called in invalid state
[Thread-3] WARN com.jcloisterzone.ui.ClientMessageListener - No controller for message com.jcloisterzone.wsio.message.ClientUpdateMessage@1772e6b
[Thread-3] WARN com.jcloisterzone.ui.ClientMessageListener - No controller for message com.jcloisterzone.wsio.message.ClientUpdateMessage@1b54c6c
[Thread-3] WARN com.jcloisterzone.ui.ClientMessageListener - No controller for message com.jcloisterzone.wsio.message.ClientUpdateMessage@102ba14
[Thread-3] WARN com.jcloisterzone.ui.ClientMessageListener - No controller for message com.jcloisterzone.wsio.message.ClientUpdateMessage@a36617
[Thread-3] WARN com.jcloisterzone.ui.ClientMessageListener - No controller for message com.jcloisterzone.wsio.message.ClientUpdateMessage@1328343
[Thread-3] ERROR com.jcloisterzone.game.phase.ActionPhase - Method 'placeTile' called in invalid state
[Thread-3] ERROR com.jcloisterzone.ui.view.GameView - NullPointerException
java.lang.NullPointerException
    at com.jcloisterzone.game.capability.PortalCapability.handleEvent(PortalCapability.java:48)
    at com.jcloisterzone.game.Game.post(Game.java:141)
    at com.jcloisterzone.game.Game.undo(Game.java:181)
    at com.jcloisterzone.ui.ClientMessageListener.handleUndo(ClientMessageListener.java:518)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.jcloisterzone.wsio.MessageDispatcher.dispatchOn(MessageDispatcher.java:36)
    at com.jcloisterzone.wsio.MessageDispatcher.dispatch(MessageDispatcher.java:20)
    at com.jcloisterzone.ui.ClientMessageListener.onWebsocketMessage(ClientMessageListener.java:143)
    at com.jcloisterzone.wsio.WebSocketConnection$WebSocketClientImpl.onMessage(WebSocketConnection.java:100)
    at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:248)
    at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:375)
    at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:158)
    at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:185)
    at java.lang.Thread.run(Unknown Source)
[Thread-3] ERROR com.jcloisterzone.game.phase.TilePhase - Method 'pass' called in invalid state
[Thread-3] WARN com.jcloisterzone.ui.ClientMessageListener - No controller for message com.jcloisterzone.wsio.message.ClientUpdateMessage@ca5703
[Thread-3] ERROR com.jcloisterzone.game.phase.TilePhase - Method 'pass' called in invalid state
LojaRich commented 7 years ago

Yeh, as mentioned, we really love the game and you are offering an amazing thing for free, but we will definitely donate a few dollars here and there, if you can fix that main issue. If everything is running smoothly, you could definitely be making money from this. It's addictive, and if each member pays $5 or $10 to sign up, you have a great opportunity.

LojaRich commented 7 years ago

I love the game, and I love getting more people to play it. Maybe when you have free time, we could discuss it more. I am actually a web-designer (no programming) and would love to help. Maybe I could re-design your site or help out in some way?

farin commented 7 years ago

@LojaRich @max-wittig I am pretty sure that this issue is related to one expansion What helps is screenshot from time when it happen (with highligheted last tile) or save game. Could you provide it please?

LojaRich commented 7 years ago

It happens any time somebody does "undo turn" or hits ctrl + z.

ziggzagman commented 7 years ago

It seems to happen most when someone lays a tile and a meeple, then tries to undo turn or ctrl+z twice in a row. Usually we can get away with undoing one portion of a turn. Undo a tile, or undo a meeple on a tile. But try to do both and it nullpoint errors.

LojaRich commented 7 years ago

Correct. We try to explain this to the new players we invite, but sometimes they forget, or sometimes it's just an accident.

ziggzagman commented 7 years ago

I was introduced to Carcassonne through jcloisterzone and I love the game and play every day with @LojaRich and friends. All of us are willing to donate some cash or buy a masterversion if these glitches are fixed. Nothing worse than that nullpoint error when your raking in the points halfway through the game! Im grateful you have made free time for such an awesome project like this and its awesome that you have let users play for free. We have and could get many more people willing to pay for the Master!

mgabielk commented 7 years ago

Hi, We just had a NullPointerException after Undo. Actually, the first Undo of the tile placement was OK, it's the second one that caused the exception. Please find the screenshots attached. Here is the stack trace on my side when a remote player made the Undo:

[Thread-2] ERROR com.jcloisterzone.ui.view.GameView - NullPointerException
java.lang.NullPointerException
    at com.jcloisterzone.wsio.MessageDispatcher.dispatchOn(MessageDispatcher.java:26)
    at com.jcloisterzone.wsio.MessageDispatcher.dispatch(MessageDispatcher.java:20)
    at com.jcloisterzone.ui.ClientMessageListener.onWebsocketMessage(ClientMessageListener.java:143)
    at com.jcloisterzone.wsio.WebSocketConnection$WebSocketClientImpl.onMessage(WebSocketConnection.java:100)
    at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:248)
    at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:375)
    at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:158)
    at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:185)
    at java.lang.Thread.run(Thread.java:748)

The game cannot be saved, other players cannot save it as well. Here is the trace I got when I tried it:

[Thread-2] ERROR com.jcloisterzone.ui.view.GameView - NullPointerException
java.lang.NullPointerException
    at com.jcloisterzone.wsio.MessageDispatcher.dispatchOn(MessageDispatcher.java:26)
    at com.jcloisterzone.wsio.MessageDispatcher.dispatch(MessageDispatcher.java:20)
    at com.jcloisterzone.ui.ClientMessageListener.onWebsocketMessage(ClientMessageListener.java:143)
    at com.jcloisterzone.wsio.WebSocketConnection$WebSocketClientImpl.onMessage(WebSocketConnection.java:100)
    at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:248)
    at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:375)
    at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:158)
    at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:185)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.jcloisterzone.game.Snapshot.createRootStructure(Snapshot.java:107)
    at com.jcloisterzone.game.Snapshot.<init>(Snapshot.java:69)
    at com.jcloisterzone.ui.view.GameView.handleSave(GameView.java:436)
    at com.jcloisterzone.ui.view.GameView$1.actionPerformed(GameView.java:110)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.jcloisterzone.game.Snapshot.createRootStructure(Snapshot.java:107)
    at com.jcloisterzone.game.Snapshot.<init>(Snapshot.java:69)
    at com.jcloisterzone.ui.view.GameView.handleSave(GameView.java:436)
    at com.jcloisterzone.ui.view.GameView$1.actionPerformed(GameView.java:110)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Here is the preset we used for the game:

expansions:
- WINTER
- INNS_AND_CATHEDRALS
- TRADERS_AND_BUILDERS
- PRINCESS_AND_DRAGON
- ABBEY_AND_MAYOR
- KING_AND_ROBBER_BARON
- PHANTOM
- FESTIVAL
- WIND_ROSE
rules:
  RANDOM_SEATING_ORDER: true
  PIG_HERD_ON_GQ_FARM: true
  TUNNELIZE_ALL_EXPANSIONS: true

screenshot from 2017-05-06 01-11-16 screenshot from 2017-05-06 01-18-47 Thanks!

farin commented 7 years ago

note: after discussion outside github it seems it can be related to network latency (and some race condition)

does anybody observe bug on local game (or when you was creator of game hosted on your machine}?

farin commented 7 years ago

With community help there is attempt to fix it If you want to verify i made build from latest sources http://jcloisterzone.com/builds/JCloisterZone-3.4.3-pre.7z I would be glad if you try it and let me know

ziggzagman commented 7 years ago

So far the new build has worked great after 3 games! No nullpoint error. Thank you! we will have to donate some money to help you with the master version!

On Sat, May 6, 2017 at 4:38 PM, Roman Krejčík notifications@github.com wrote:

With community help there is attempt to fix it If you want to verify i made build from latest sources http://jcloisterzone.com/builds/JCloisterZone-3.4.3-pre.7z I would be glad if you try it and let me know

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/farin/JCloisterZone/issues/224#issuecomment-299667441, or mute the thread https://github.com/notifications/unsubscribe-auth/AbIXSUExwdfxIP98rIn7z3zqqbAKk83bks5r3OhOgaJpZM4LhLYj .

LojaRich commented 7 years ago

Yes, you need a PayPal donate button on your site. Also, I will design a free website for you (this will attract new players) and I can help with SEO. You will have to pay for your domain name/URL/hosting, but I will design it for free.

farin commented 7 years ago

yeah, i should put donation info to website meanwhile, anybody can donate directly to paypal: farin@farin.cz or BTC wallet: 1GdBvatFH4Md9XsYyksU28xssUrnqhaims

LojaRich commented 7 years ago

Check your Facebook... I sent you a link.

farin commented 7 years ago

@LojaRich I already noticed, don't worry I am going to reply (today or tomorrow) I was focused to get 3.4.3 out officially :)