Skip to main content

thread to discuss 6322854

32 replies [Last post]
oleg_sukhodolsky
Offline
Joined: 2006-02-06

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cnaunton
Offline
Joined: 2004-08-02

neopallium and others: thanks a lot for debugging this problem. When I was Googling it a couple of months ago I found nothing useful, and I had no idea synergy would be responsible for it.

For those who don't wont the bother of applying the patch and compiling from source, here's what I did on Ubuntu to workaround the problem:

Download the 32bit package from here: http://packages.ubuntu.com/hardy/i386/synergy/download

$ sudo aptitude remove synergy quicksynergy
$ sudo aptitude install ia32-libs
$ sudo dpkg -i --force-architecture /path/to/synergy_1.3.1-2ubuntu2_i386.deb

The 32 bit version works fine and is immune from the problem. Hope it helps.

neopallium
Offline
Joined: 2008-07-06

> 0x189, 0x18a, 0x18b, 0x194, 0xf4, 0x195, 0x196, 0x197, 0x1f, 0x0, 0x14aa1, 0xfffffffff9530698, 0xfffffffff9530698, 0x18a, 0x18b, 0x194, 0xf4, 0x195
My testing of synergy server shows that it is only sending 9 atoms (72bytes, 8bytes * 9 atoms).
Here are the values that are being sent:
0x173, 0x174, 0x175, 0x17e, 0x152, 0x17f, 0x180, 0x181, 0x1f

I think every thing after the 0x1f is garbage. Can you check how many bytes are being received on java's side?

neopallium
Offline
Joined: 2008-07-06

found the bug. When synergy calls XChangeProperty it was using the format value to calculate how many "32-bit" elements where in the array. So it was passing 18 to XChangeProperty instead of 9.

I will make a patch for synergy once I have cleaned out all my debug code.

neopallium
Offline
Joined: 2008-07-06

I have submitted a bug report to the synergy2 project and attached my patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=2033712&group_i...

ixmal
Offline
Joined: 2004-08-08

> I have submitted a bug report to the synergy2 project
> and attached my patch:
> http://sourceforge.net/tracker/index.php?func=detail&a
> id=2033712&group_id=59275&atid=490467

Thank you for your help! Hope, synergy developers will integrate it into some upcoming releases, if any (developers or releases).

Now it's time to check if this fix also helps with the original problem described in 6322854. What I found is an NPE from XClipboard.getContents(), while the bug is about NPE from XNETProtocol.getState() which is a bit different place... Can anybody check the patch and confirm or deny the initial NPE is not thrown anymore, please?

Thanks,
Artem

trembovetski
Offline
Joined: 2003-12-31

> 0xfffffffff9530698

these sure look like 64-bit pointers (or 32-bit ones stuffed into 64 pointer type),.

Dmitri

neopallium
Offline
Joined: 2008-07-06

Synergy is trying to send 64bit Atoms. They are being encoded as 64bit values, but the format is set to 32-bits. Right now I would say that 64bit synergy is broken.

I might try to create a patch to fix 64bit synergy.

ixmal
Offline
Joined: 2004-08-08

> Synergy is trying to send 64bit Atoms. They are
> being encoded as 64bit values, but the format is set
> to 32-bits. Right now I would say that 64bit synergy
> is broken.

Exactly! When synergy fills the property in reply to XConvertSelection call, the property has actual type of 32, but the values looks like 64-bit.

> I might try to create a patch to fix 64bit synergy.

It would be very helpful.

neopallium
Offline
Joined: 2008-07-06

> Exactly! When synergy fills the property in reply to
> XConvertSelection call, the property has actual type
> of 32, but the values looks like 64-bit.

It turns out that XChangeProperty & XGetWindowProperty require arrays of 64bit values from 64bit code when the format is set to 32. So the problem is not where I though it was.

Do you have a simple test program that shows what the java side is receiving?

ixmal
Offline
Joined: 2004-08-08

There is no way to attach a file at this forum, so I have attached it there:

https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/207057

This is a thread on ubuntu forum about the same problem with Java and synergy.

neopallium
Offline
Joined: 2008-07-06

Both my laptop and my desktop are amd64.

I re-compiled synergy as 32bit code on my desktop (the synergy server) and this stopped the NPEs from happening on my desktop.

My laptop was still running a 64bit synergy client and the NPEs still happened.

eputrycz
Offline
Joined: 2007-05-17

> Both my laptop and my desktop are amd64.
>
> I re-compiled synergy as 32bit code on my desktop
> (the synergy server) and this stopped the NPEs from
> happening on my desktop.
>
> My laptop was still running a 64bit synergy client
> and the NPEs still happened.

How do you do that?? If that is that easy, it will make my day.

Erik

neopallium
Offline
Joined: 2008-07-06

You might be able to download the 32bit synergy package from your linux distro's repository and install that. It is similar to how you would use 32bit firefox to support the 32bit only plugins like flash.

My system is setup with all the 32bit & 64bit development libraries, so it is easy for me to compile code as either.

But if you still want to try compiling it:
1. wget http://downloads.sourceforge.net/synergy2/synergy-1.3.1.tar.gz
2. tar zxvf synergy-1.3.1.tar.gz
3. cd synergy-1.3.1/
4. CFLAGS=" -m32 " CXXFLAGS=" -m32 " ./configure --prefix=/usr
5. make
6. make install

The -m32 flags tells the compiler to build 32-bit code.
Step 6 is the only one that would need to be run as root to replace the installed synergy.

jvdavis
Offline
Joined: 2008-07-29

When you say that most of the NPE's are thrown when obtaining CLIPBOARD or PRIMARRY, what fraction is this? On my setup, NPE's were being thrown one after another (as soon as I close the dialog, another appears).

I agree with Erik, hopefully we can fix things on the java side.

Jason

ixmal
Offline
Joined: 2004-08-08

> When you say that most of the NPE's are thrown when
> obtaining CLIPBOARD or PRIMARRY, what fraction is
> this? On my setup, NPE's were being thrown one after
> another (as soon as I close the dialog, another
> appears).

I observe NPEs when NetBeans is starting, right before the main window appears. The stack trace is:

java.lang.NullPointerException: Failed to retrieve atom name.
at sun.awt.X11.XlibWrapper.XGetAtomName(Native Method)
at sun.awt.X11.XAtom.getName(XAtom.java:186)
at sun.awt.X11.XDataTransferer.getTargetNameForAtom(XDataTransferer.java:141)
at sun.awt.X11.XDataTransferer.getNativeForFormat(XDataTransferer.java:130)
at sun.awt.datatransfer.DataTransferer.getFlavorsForFormatsAsSet(DataTransferer.java:855)
at sun.awt.datatransfer.SunClipboard.formatArrayAsDataFlavorSet(SunClipboard.java:350)
at sun.awt.datatransfer.SunClipboard.addFlavorListener(SunClipboard.java:378)
at org.netbeans.core.NbClipboard.(NbClipboard.java:90)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:539)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
[catch] at org.openide.util.lookup.MetaInfServicesLookup$P.getInstance(MetaInfServicesLookup.java:428)
at org.openide.util.lookup.AbstractLookup.lookup(AbstractLookup.java:378)
at org.openide.util.lookup.ProxyLookup.lookup(ProxyLookup.java:214)
at org.netbeans.core.NonGui.run(NonGui.java:117)
at org.netbeans.core.startup.Main.start(Main.java:332)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:110)
at java.lang.Thread.run(Thread.java:674)

> I agree with Erik, hopefully we can fix things on the
> java side.

Well... We can ignore 0x0 atoms (however, I'd expect they must never be queried for a name), but what can we do with other atoms like 0xfffffffff9530698? Use null atom names if XGetAtomName returns null? I suspect XAWT code is not ready for this...

Artem

neopallium
Offline
Joined: 2008-07-06

> Well... We can ignore 0x0 atoms (however, I'd expect
> they must never be queried for a name), but what can
> we do with other atoms like 0xfffffffff9530698? Use
> null atom names if XGetAtomName returns null? I
> suspect XAWT code is not ready for this...

I made a some change to icedtea 1.7.0 that makes it return an empty string and some printf's to show all the atoms id and string. This is how I found out about synergy being the problem. Returning an empty string might work as a fix to the JVM. I think the JVM should ignore bad atoms without throwing a NPE.

Here is the changes(including the debug printfs):

--- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_DataTransferer.c 2008-07-10 19:48:21.000000000 -0700
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_DataTransferer.c 2008-07-10 19:26:26.000000000 -0700
@@ -351,6 +351,7 @@

name = XGetAtomName(awt_display, (Atom) atom);

+ fprintf(stderr, "Atom '%ld' name='%s'\n", (long)atom, name);
if (name == NULL) {
JNU_ThrowNullPointerException(env, "Failed to retrieve atom name.");
AWT_UNLOCK();
--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XlibWrapper.c 2008-07-10 19:48:21.000000000 -0700
+++ openjdk/jdk/src/solaris/native/sun/xawt/XlibWrapper.c 2008-07-10 22:59:12.000000000 -0700
@@ -1457,11 +1457,18 @@
AWT_CHECK_HAVE_LOCK();
name = (char*) XGetAtomName((Display*)jlong_to_ptr(display), atom);

+ fprintf(stderr, "Atom '%ld' name='%s'\n", (long)atom, name);
if (name == NULL) {
- fprintf(stderr, "Atom was %d\n", (int)atom);
+ string = (*env)->NewStringUTF(env, "");
+ return string;
+ }
+ /*
+ if (name == NULL) {
+ fprintf(stderr, "Atom was %ld\n", (long)atom);
JNU_ThrowNullPointerException(env, "Failed to retrieve atom name.");
return NULL;
}
+ */

string = (*env)->NewStringUTF(env, (const char *)name);

ixmal
Offline
Joined: 2004-08-08

Finally, I have caught the exceptions. synergy server is launched on my winxp, clients are attached from the same winxp and x86_64 linux. When running NetBeans on this linux I observe several 'Atom was 0' messages in the console and many NPEs in NetBeans log.

Will investigate the problem. Thanks everyone for the help.

ixmal
Offline
Joined: 2004-08-08

After some further investigation I found most of NPEs are thrown when obtaining a list of formats for CLIPBOARD or PRIMARY selection. To get the list, a call to XConvertSelection is performed, and then returned array is converted to the list of atoms. When synergy server is launched from 64-bit linux, array returned is:

0x189, 0x18a, 0x18b, 0x194, 0xf4, 0x195, 0x196, 0x197, 0x1f, 0x0, 0x14aa1, 0xfffffffff9530698, 0xfffffffff9530698, 0x18a, 0x18b, 0x194, 0xf4, 0x195

which is strange. The first half of the array looks reasonable, and the second half (0x0 and all the next values) looks broken, and subsequent calls to XGetAtomName for them fail with NPE. Something may be wrong with the number of items returned, or some bug in synergy exist.

I have also created a native test which demonstrates the same behaviour. I'm going to file a bug against synergy developers and wait for their replies.

eputrycz
Offline
Joined: 2007-05-17

> I have also created a native test which demonstrates
> the same behaviour. I'm going to file a bug against
> synergy developers and wait for their replies.

Hopefully this can be fixed on the java side... The synergy project is rather dead.

Erik

ixmal
Offline
Joined: 2004-08-08

> I have found out why this is happening on my computer
> when using netbeans 6.1 and how to make the Exception
> go away long enought to launch netbeans correctly.
> The problem is cause by another program I was
> running call Synergy that allows me to controll my
> laptop from my desktops keyboard and mouse. My
> desktop runs Gentoo Linux 2007.0 with WindowMaker as
> the desktop manager and is setup as the Synergy
> server. My Laptop runs Fedora 8 with KDE as desktop
> manager. The problem seems to only happen when I
> try to copy text from my laptop that causes Synergy
> to add that text the Xserver's clipboard which
> causes this exception. If I restart the Synergy
> server on my desktop by killing it and starting a
> new instance this clears the clipboard and the
> exception doesn't happen.

I have just installed Synergy onto my linux (ubuntu 8.04) and winxp desktops and launched NetBeans on both. (Un)fortunately, no exceptions are thrown, clipboard works as expected, with different JDK versions (5.0u?, 6u?). Window manager used is e16 or windowmaker.

I have two ideas so far: the problem can only be reproduced using two linux desktops or it can only be reproduced with mixed 32/64-bit configuration. Can you confirm or deny these assumptions?

Thanks,
Artem

jvdavis
Offline
Joined: 2008-07-29

I'm running Ubuntu 8.0.4, jdk 6, with an amd64 processor. My synergy server is running of a 32 bit windows machine.

I can startup netbeans without any problem, and as soon as I turn on synergy, the NullPointer exception gets throw over and over again.

Thanks,
Jason

eputrycz
Offline
Joined: 2007-05-17

> I'm running Ubuntu 8.0.4, jdk 6, with an amd64
> processor. My synergy server is running of a 32 bit
> windows machine.

Same here, OpenSuse 11 64 bits with an Intel 64 bit processor and 32 bit windows.
I have the synergy server on the linux machine and a synergy client on windows.

Erik.

neopallium
Offline
Joined: 2008-07-06

I have found out why this is happening on my computer when using netbeans 6.1 and how to make the Exception go away long enought to launch netbeans correctly. The problem is cause by another program I was running call Synergy that allows me to controll my laptop from my desktops keyboard and mouse. My desktop runs Gentoo Linux 2007.0 with WindowMaker as the desktop manager and is setup as the Synergy server. My Laptop runs Fedora 8 with KDE as desktop manager. The problem seems to only happen when I try to copy text from my laptop that causes Synergy to add that text the Xserver's clipboard which causes this exception. If I restart the Synergy server on my desktop by killing it and starting a new instance this clears the clipboard and the exception doesn't happen.

How many other people are using Synergy and getting this error? There might be other programs that cause this problem. I still think there is a bug in the java vm that is not correctly handing some clipboard data from the Xserver, since I can copy & paste between my desktop and laptop using other programs without any problems.

Here is a link to Synergy: http://synergy2.sourceforge.net/

eputrycz
Offline
Joined: 2007-05-17

> I have found out why this is happening on my computer
> when using netbeans 6.1 and how to make the Exception
> go away long enought to launch netbeans correctly.
> The problem is cause by another program I was
> running call Synergy that allows me to controll my
> laptop from my desktops keyboard and mouse.

Great find!! I'm also using synergy. Now they can have an easy repro for the jdk bug.

andrejschoeke
Offline
Joined: 2008-05-13

Hi,

I use a MacBook C2D with Gentoo linux. Almost every java programs quits for no apparent reason with the mentioned error messages. I can only reproduce it in the program RapidMiner.

I will post the error message today, but it will take some hours before I get my hand on the log.

andrejschoeke
Offline
Joined: 2008-05-13

Here is the error message:

May 13, 2008 6:37:42 PM: Loading operators from '/home/pathto/rapidminer-4.1beta2/lib/plugins/rapidminer-text-4.1beta2.jar'.
Atom was 8133696
Exception on Toolkit thread: java.lang.NullPointerException: Failed to retrieve atom name.
java.lang.NullPointerException: Failed to retrieve atom name.
at sun.awt.X11.XlibWrapper.XGetAtomName(Native Method)
at sun.awt.X11.XAtom.(XAtom.java:219)
at sun.awt.X11.XAtom.get(XAtom.java:146)
at sun.awt.X11.XAtom.getAtomListProperty(XAtom.java:630)
at sun.awt.X11.XAtom.getAtomListProperty(XAtom.java:650)
at sun.awt.X11.XNETProtocol.getState(XNETProtocol.java:109)
at sun.awt.X11.XWM.getExtendedState(XWM.java:1024)
at sun.awt.X11.XWM.isStateChange(XWM.java:1075)
at sun.awt.X11.XFramePeer.handlePropertyNotify(XFramePeer.java:344)
at sun.awt.X11.XBaseWindow.dispatchEvent(XBaseWindow.java:823)
at sun.awt.X11.XWindowPeer.dispatchEvent(XWindowPeer.java:476)
at sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:767)
at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:394)
at sun.awt.X11.XToolkit.run(XToolkit.java:493)
at sun.awt.X11.XToolkit.run(XToolkit.java:438)
at java.lang.Thread.run(Thread.java:595)
Atom was 8172464
Exception on Toolkit thread: java.lang.NullPointerException: Failed to retrieve atom name.
java.lang.NullPointerException: Failed to retrieve atom name.
at sun.awt.X11.XlibWrapper.XGetAtomName(Native Method)
at sun.awt.X11.XAtom.(XAtom.java:219)
at sun.awt.X11.XAtom.get(XAtom.java:146)
at sun.awt.X11.XAtom.getAtomListProperty(XAtom.java:630)
at sun.awt.X11.XAtom.getAtomListProperty(XAtom.java:650)
at sun.awt.X11.XNETProtocol.getState(XNETProtocol.java:109)
at sun.awt.X11.XWM.getExtendedState(XWM.java:1024)
at sun.awt.X11.XWM.isStateChange(XWM.java:1075)
at sun.awt.X11.XFramePeer.handlePropertyNotify(XFramePeer.java:344)
at sun.awt.X11.XBaseWindow.dispatchEvent(XBaseWindow.java:823)
at sun.awt.X11.XWindowPeer.dispatchEvent(XWindowPeer.java:476)
at sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:767)
at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:394)
at sun.awt.X11.XToolkit.run(XToolkit.java:493)
at sun.awt.X11.XToolkit.run(XToolkit.java:438)
at java.lang.Thread.run(Thread.java:595)
Atom was 8172464
Exception on Toolkit thread: java.lang.NullPointerException: Failed to retrieve atom name.
java.lang.NullPointerException: Failed to retrieve atom name.
at sun.awt.X11.XlibWrapper.XGetAtomName(Native Method)
at sun.awt.X11.XAtom.(XAtom.java:219)
at sun.awt.X11.XAtom.get(XAtom.java:146)
at sun.awt.X11.XAtom.getAtomListProperty(XAtom.java:630)
at sun.awt.X11.XAtom.getAtomListProperty(XAtom.java:650)
at sun.awt.X11.XNETProtocol.getState(XNETProtocol.java:109)
at sun.awt.X11.XWM.getExtendedState(XWM.java:1024)
at sun.awt.X11.XWM.isStateChange(XWM.java:1075)
at sun.awt.X11.XFramePeer.handlePropertyNotify(XFramePeer.java:344)
at sun.awt.X11.XBaseWindow.dispatchEvent(XBaseWindow.java:823)
at sun.awt.X11.XWindowPeer.dispatchEvent(XWindowPeer.java:476)
at sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:767)
at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:394)
at sun.awt.X11.XToolkit.run(XToolkit.java:493)
at sun.awt.X11.XToolkit.run(XToolkit.java:438)
at java.lang.Thread.run(Thread.java:595)

oleg_sukhodolsky
Offline
Joined: 2006-02-06

what version of java do you use (java -version would be very useful)?
What version of X-server and what window manager do you use?

andrejschoeke
Offline
Joined: 2008-05-13

System Java version is sun-jdk-1.6 (1.6.0.05 specifically), but in gentoo, the user and system java-vm can be different. So for user, right now, it is 1.5.0_15-b04.
X-Server version 1.3.0 (Protocol Version 11, Revision 0, Release 1.3)
FluxBox version is 1.0 is the Window Manager.

If you need more, just ask. :)

oleg_sukhodolsky
Offline
Joined: 2006-02-06

is your system is 64-bits or 32bits?
Also could you try jdk 1.6 instead of 1.5.

Thanks, Oleg.

andrejschoeke
Offline
Joined: 2008-05-13

It is a Intel Core 2 Duo.
CHOST="x86_64-pc-linux-gnu"

I changed the User-vm already, but did not have time to check the result until now as the error appears randomly.

oleg_sukhodolsky
Offline
Joined: 2006-02-06

could you please also send me output of
xprop -root _NET_SUPPORTED
And it would be very interesting to see output of
xprop _NET_WM_STATE

for windows in different state (e.g. maximized, normal, minimized). Of course it would
be even more interesting if you would be able to do this for java window (if you is able
to show one)

Thanks in advance, Oleg.

eputrycz
Offline
Joined: 2007-05-17

Here 64 bit system
Linux iitm50ws1106 2.6.25.4-10-default #1 SMP 2008-05-28 16:25:04 +0200 x86_64 x86_64 x86_64 GNU/Linux

putrycze@iitm50ws1106:~/Desktop> xprop -root _NET_SUPPORTED
_NET_SUPPORTED(ATOM) = _NET_WM_NAME, _NET_CLOSE_WINDOW, _NET_WM_STATE, _NET_WM_STATE_SHADED, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_CURRENT_DESKTOP, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_STATE_MODAL, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER, _NET_WM_ICON_NAME, _NET_WM_ICON, _NET_WM_ICON_GEOMETRY, _NET_WM_MOVERESIZE, _NET_ACTIVE_WINDOW, _NET_WM_STRUT, _NET_WM_STATE_HIDDEN, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_STATE_FULLSCREEN, _NET_WM_PING, _NET_WM_PID, _NET_WORKAREA, _NET_SHOWING_DESKTOP, _NET_DESKTOP_LAYOUT, _NET_DESKTOP_NAMES, _NET_WM_ALLOWED_ACTIONS, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_STATE_ABOVE, _NET_WM_STATE_BELOW, _NET_STARTUP_ID, _NET_WM_STRUT_PARTIAL, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MINIMIZE, _NET_FRAME_EXTENTS, _NET_REQUEST_FRAME_EXTENTS, _NET_WM_USER_TIME, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_DESKTOP_GEOMETRY, _NET_DESKTOP_VIEWPORT, _NET_WM_USER_TIME_WINDOW, _NET_MOVERESIZE_WINDOW, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW

putrycze@iitm50ws1106:~/Desktop> xprop _NET_WM_STATE

_NET_WM_STATE(ATOM) =