Jump to content

Welcome to our forums!

Sign In or Register to gain full access to our forums. By registering with us, you'll be able to discuss, share and private message with other members of our community.

Photo

Damn you Linux/Java :(


This topic has been archived. This means that you cannot reply to this topic.
25 replies to this topic

#1 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 23 August 2013 - 09:34 AM

Can people who are having issues running the latest version please post your OS specs here? I think this is a long standing bug with the JVM on some Linux machines requiring a call to XInitThreads in the XWindowing system that's not getting called. It is COMPLETELY out of my power to call this, as it needs to be called effectively before the first line of 'main' in the PZ program, aka before the actual java code ever starts, so it's up to the JVM to do this not I. :(

 

You could try installing latest graphic drivers / version of java, if you've not already, perhaps the problem I read so many places was later solved in a JVM update? but sadly there's likely nothing I can do but remove the significant performance boosting render system that was added to 16 (which after months of moaning about FPS, not one person has mentioned btw :P)

 

Question is whether I need to remove it across entire Linux or if it needs to be a menu option. i.e. are there Linux people who don't get this error?

 

If I can figure out exactly what versions its affecting maybe I can better check for it?

 

Thanks!



#2 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 11:20 AM

I don't think it's an Ubuntu thing. Also, what makes you think it's a Java problem?

 

I run on gentoo, Oracle JDK 1.7.0.25. AMD64

 

I also tried IcedTea JDK 6.1.12.6 and I got the same crash.

 

Also, the bug is triggered by moving the mouse or pressing a key. If you keep the mouse still, everything runs. 



#3 CareBearCorpse

CareBearCorpse

    Advanced Member

  • Members
  • PipPipPip
  • 95 posts

Posted 23 August 2013 - 11:52 AM

Linux i386 - Kubuntu 12.04

 

java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK Server VM (build 23.7-b01, mixed mode
 
(in the process of upgrading the whole system, which seems to be required to be able to install latest linux Intel drivers)
 

 

 

I don't think it's an Ubuntu thing. Also, what makes you think it's a Java problem?

 

It doesn't seem to be a Java problem per se, but as Lemmy said above a failure from the JVM linux (not only Ubuntu it seems) implementation to call a Linux low level rendering function. (see http://forums.wxwidg...hp?f=23&t=32346).
 
Now i'm naively wondering, since the game crashes on main screen (for me at least), is it already too late to call this function in the main; or is it just not possible to call it at all ?


#4 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 12:12 PM

Maybe it has to do with XInitThreads()? It has to be called (and complete) before any other xlib functions are called.

 

Is this because of java / awt not calling XinitThreads() ? This appears to be a common complaint... if that's the case then it's a pretty bad bug.


Edited by Eggplanticus, 23 August 2013 - 12:24 PM.


#5 harakka

harakka

    Technical Support Advisor, Third Order

  • Members
  • PipPipPip
  • 1840 posts

Posted 23 August 2013 - 12:30 PM

Is this an issue with both OpenJDK and Oracle JVMs?


A short, sturdy creature fond of drink and industry.

#6 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 23 August 2013 - 01:38 PM

Maybe it has to do with XInitThreads()? It has to be called (and complete) before any other xlib functions are called.

 

Is this because of java / awt not calling XinitThreads() ? This appears to be a common complaint... if that's the case then it's a pretty bad bug.

 

yep this is it exactly. We changed the game rendering system to be multithreaded, which has resulted in a 20-30 FPS improvement for more or less everyone who had FPS issues. Obviously this was needed due to the FPS complaints lately

 

Obv I can go back to how it was for linux (tho a pain in the ass obv getting both systems running on a switch :( ) but those affected will just have to deal with that slower framerate, since there is literally nothing else I can do without a COMPLETE rewrite of the sprite engine (don't hold your breath), given the bottleneck is in vertex/index buffer mapping. That has to happen, and if it can't happen on another thread then it'll cost the FPS due to how much is drawn. :(



#7 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 02:09 PM

 

Maybe it has to do with XInitThreads()? It has to be called (and complete) before any other xlib functions are called.

 

Is this because of java / awt not calling XinitThreads() ? This appears to be a common complaint... if that's the case then it's a pretty bad bug.

 

yep this is it exactly. We changed the game rendering system to be multithreaded, which has resulted in a 20-30 FPS improvement for more or less everyone who had FPS issues. Obviously this was needed due to the FPS complaints lately

 

Obv I can go back to how it was for linux (tho a pain in the ass obv getting both systems running on a switch :( ) but those affected will just have to deal with that slower framerate, since there is literally nothing else I can do without a COMPLETE rewrite of the sprite engine (don't hold your breath), given the bottleneck is in vertex/index buffer mapping. That has to happen, and if it can't happen on another thread then it'll cost the FPS due to how much is drawn. :(

 

Would putting an xinitthreads() call in the very first line of the launchdialog constructor fix it (before the call to super())?



#8 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 03:14 PM

Or, better, in the first line of main?



#9 harakka

harakka

    Technical Support Advisor, Third Order

  • Members
  • PipPipPip
  • 1840 posts

Posted 23 August 2013 - 03:24 PM

 

 

Maybe it has to do with XInitThreads()? It has to be called (and complete) before any other xlib functions are called.

 

Is this because of java / awt not calling XinitThreads() ? This appears to be a common complaint... if that's the case then it's a pretty bad bug.

 

yep this is it exactly. We changed the game rendering system to be multithreaded, which has resulted in a 20-30 FPS improvement for more or less everyone who had FPS issues. Obviously this was needed due to the FPS complaints lately

 

Obv I can go back to how it was for linux (tho a pain in the ass obv getting both systems running on a switch :( ) but those affected will just have to deal with that slower framerate, since there is literally nothing else I can do without a COMPLETE rewrite of the sprite engine (don't hold your breath), given the bottleneck is in vertex/index buffer mapping. That has to happen, and if it can't happen on another thread then it'll cost the FPS due to how much is drawn. :(

 

Would putting an xinitthreads() call in the very first line of the launchdialog constructor fix it (before the call to super())?

 

super() always has to be called first, either implicitly or explicitly, so that isn't an option.


A short, sturdy creature fond of drink and industry.

#10 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 23 August 2013 - 03:27 PM

Or, better, in the first line of main?

 

no, it needs to be created before the java main thread is created. AKA before main() which is the earliest possible time you could call it. Much better programmers than I with a ton more linux experience than I have said this is not fixable, the makers of lwjgl expressed their frustration and lack of power to do anything, so am inclined to believe that.



#11 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 03:35 PM

I managed to get 2.9.9.16 to run by calling XInitThreads() on the first line of main.

 

I'm not saying that this is necessarily a good or reliable way to do things, since, as you said, others before us have tried and failed, but in my case it works.


Edited by Eggplanticus, 23 August 2013 - 03:36 PM.


#12 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 23 August 2013 - 03:36 PM

Really? :-| well I take that back then and wonder why in hell everyone's so pissed off about it in the OGL / LWJGL communities.

 

OK so question 2) How in fuck do I call XInitThreads? :D



#13 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 23 August 2013 - 03:38 PM

I mean, it's a native function, C right? how did you call it?



#14 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 03:43 PM

OK, saying this is a hack is an understatement, but I did the following:

 

1) I made a small library in C whose sole purpose is to call XInitThreads

//--------------------------------------------------------------------------------------------------
//xdll.cpp
//--------------------------------------------------------------------------------------------------

// compile with g++ -o libxx.so -shared -fPIC -Wl,-soname,libxx.so -L/usr/lib/X11 -I/usr/include/X11 xdll.cpp -lX11

#include <Xlib.h>
#include <stdio.h>

class a{
public:
  a() { XInitThreads(); }
};

a X;

 

2) I compiled it and copied it to my projectzomboid directory (libxx.so).

 

3) Then I put a breakpoint in the first line of main of my decompiled pz source.

When the breakpoint triggered I evaluated the expression System.loadLibrary("xx");

This loaded the library and caused XInitThreads() to get called.

Then I continued the program, and to my suprise, it didn't crash and I created a new world and ran around for a bit.



#15 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 23 August 2013 - 03:51 PM

:D any chance I can get a copy of that so :D I'm not in a position to build one myself. We will give you a lovely contributor credit if it works for everyone :D (also it seems perfectly reasonable thing to do imo, not really a hack at all)



#16 Eggplanticus

Eggplanticus

    Enchanted by Ladders

  • Members
  • PipPipPip
  • 141 posts

Posted 23 August 2013 - 03:58 PM

No problem - I built it for AMD64. I'm not totally sure how to cross-compile it at the moment, but I can look into it.

Attached Files



#17 WonkyLegs

WonkyLegs

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 23 August 2013 - 04:17 PM

The game runs on my system:

 

Kernel: Linux desktop 3.10.6-2-ARCH #1 SMP PREEMPT Tue Aug 13 10:20:52 CEST 2013 i686 GNU/Linux

Graphics Driver: Nvidia 325.15

OpenJDK Runtime Environment (IcedTea 2.4.1) (ArchLinux build 7.u40_2.4.1-2-i686)

 

I'm still unable to walk through crafted doors in this version (on a version 15 save game). Is this bug supposed to be already fixed in version 16?



#18 snipertyler

snipertyler

    Member

  • Members
  • PipPip
  • 33 posts

Posted 23 August 2013 - 05:37 PM

I got the common Main exception error and doing this got me to here

 

Also, the bug is triggered by moving the mouse or pressing a key. If you keep the mouse still, everything runs.

which output this when I moved the mouse over the screen: AL lib: ReleaseALC: 1 device not closed

 

Doing it again got me this:

 

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
java: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted

and a different message the next time..

 

[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
java: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Aborted

 

The bolded part sounds like the posts above ^^

 

Edit: This isn't important, and I don't know if anyone has noticed this, but in the projectzomboid.sh file, the line containing:

INSTDIR="`dirname $0`" ; cd "${INSTDIR}" ; INSTDIR="`pwd`"

looks like a long way of just doing this:

INSTDIR=$(pwd)

 

I run the Amd64 version

Kernel: 3.8.0-19-generic x86_64 (64 bit, gcc: 4.7.3) ; Linux Mint 15 Olivia (derived from Ubuntu)
Graphics:  Card: Intel 3rd Gen Core processor Graphics Controller

Java version "1.7.0_25"

OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
 


People still use Windows?


#19 lemmy101

lemmy101

    Co-Founder, Developer, Ninja

  • PZ Dev
  • PipPipPip
  • 1369 posts

Posted 24 August 2013 - 04:49 PM

No problem - I built it for AMD64. I'm not totally sure how to cross-compile it at the moment, but I can look into it.

 

thanks :) 



#20 CareBearCorpse

CareBearCorpse

    Advanced Member

  • Members
  • PipPipPip
  • 95 posts

Posted 27 August 2013 - 06:12 PM

Here is the 32 bit version of Eggplanticus's library if it's any use to anyone :
EDIT : removed my build link for 32-bit, use Eggplanticus's instead
(damn add attachment button where have you gone ?)
 
And here is a link to Eggplanticus's real helpful thread about how to decompile/debug PZ with eclipse :
http://theindiestone...nd-decompiling/