Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332229 - SIGBUS in ~/.eclipse/.../libswt-pi-gtk-3557.so due to inaccessible homedir
Summary: SIGBUS in ~/.eclipse/.../libswt-pi-gtk-3557.so due to inaccessible homedir
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 12:55 EST by Daniel Richard G. CLA
Modified: 2018-05-14 14:51 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Richard G. CLA 2010-12-09 12:55:12 EST
Build Identifier: M20100211-1343

Background: My home directory is served out of AFS. When my Kerberos authentication expires after ten hours, all of $HOME becomes inaccessible with "Permission denied" errors. I am using Eclipse 3.5.2 as packaged by Ubuntu, on an AMD64 Ubuntu Maverick system.

When I leave Eclipse open overnight, I often come back in the morning to find that it has crashed. Recently, I left GDB attached to the Java process to see what that would yield. I returned to this:

[...]
[New Thread 0x7f0342a3b710 (LWP 13116)]
[Thread 0x7f0342a3b710 (LWP 13116) exited]
[New Thread 0x7f0342a3b710 (LWP 13117)]
[Thread 0x7f0342a3b710 (LWP 13117) exited]

Program received signal SIGBUS, Bus error.
[Switching to Thread 0x7f0387d4d710 (LWP 5413)]
0x00007f03451e34e0 in ?? ()
(gdb)

The stack trace was not helpful, but according to this line in /proc/$PID/maps ...

7f0345196000-7f0345200000 r-xp 00000000 00:15 6972020                    /afs/example.com/user/daniel/.eclipse/org.eclipse.platform_3.5.0_155965261/configuration/org.eclipse.osgi/bundles/144/1/.cp/libswt-pi-gtk-3557.so

...the address at issue was inside a shared library that resides in my homedir.

Shared libraries in AFS homedirs, I've found, are a recipe for crashes. It has been an issue with Firefox and the Flash plug-in under ~/.mozilla/plug-ins/, and it certainly seems to be the case here. I don't know why Eclipse is copying shared libraries into $HOME when they are available under /usr/lib, but at any rate would suggest somewhere under /tmp as a better alternative.

Reproducible: Always

Steps to Reproduce:
This could probably be reproduced on a non-AFS system with "chmod 000 ~".
Comment 1 Leo Ufimtsev CLA 2018-05-14 14:51:02 EDT
(In reply to Daniel Richard G. from comment #0)
> Build Identifier: M20100211-1343
> 
> Background: My home directory is served out of AFS. When my Kerberos
> authentication expires after ten hours, all of $HOME becomes inaccessible
> with "Permission denied" errors. I am using Eclipse 3.5.2 as packaged by
> Ubuntu, on an AMD64 Ubuntu Maverick system.
> 
> When I leave Eclipse open overnight, I often come back in the morning to
> find that it has crashed. Recently, I left GDB attached to the Java process
> to see what that would yield. I returned to this:
> 
> [...]
> [New Thread 0x7f0342a3b710 (LWP 13116)]
> [Thread 0x7f0342a3b710 (LWP 13116) exited]
> [New Thread 0x7f0342a3b710 (LWP 13117)]
> [Thread 0x7f0342a3b710 (LWP 13117) exited]
> 
> Program received signal SIGBUS, Bus error.
> [Switching to Thread 0x7f0387d4d710 (LWP 5413)]
> 0x00007f03451e34e0 in ?? ()
> (gdb)
> 
> The stack trace was not helpful, but according to this line in
> /proc/$PID/maps ...
> 
> 7f0345196000-7f0345200000 r-xp 00000000 00:15 6972020                   
> /afs/example.com/user/daniel/.eclipse/org.eclipse.platform_3.5.0_155965261/
> configuration/org.eclipse.osgi/bundles/144/1/.cp/libswt-pi-gtk-3557.so
> 
> ...the address at issue was inside a shared library that resides in my
> homedir.
> 
> Shared libraries in AFS homedirs, I've found, are a recipe for crashes. It
> has been an issue with Firefox and the Flash plug-in under
> ~/.mozilla/plug-ins/, and it certainly seems to be the case here. I don't
> know why Eclipse is copying shared libraries into $HOME when they are
> available under /usr/lib, but at any rate would suggest somewhere under /tmp
> as a better alternative.
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> This could probably be reproduced on a non-AFS system with "chmod 000 ~".

Hello Daniel,

I looked into the SWT library loading mechanism a while back.

Basically, when SWT runs as an OSGi bundles, the mechanism works as following:

1) If eclipse's root folder is READ_ONLY, then eclipse/osgi will extract some native libraries (e.g GTK glue code, various image resources) into a temporary directory in your home directory ~/.eclipse.
This is needed because SWT uses native libraries (.so) to interact with the operating system, which must be extracted into a folder for the JVM to read them.

2) If eclipse's root folder is Read and Write, then eclipse/osgi will extract files into <your eclipse folder>/eclipse/configuration/...../osgi

So in your case, since your home folder is sometimes not accessible, one solution for you would be to download eclipse and extract it into a Read/Write directory.

E.g from here:
http://download.eclipse.org/eclipse/downloads/

Another option might be to try and set your $HOME to a permanent local folder and sync your file system onto your AFS instead. In my experience, running applications from a mounted folder has some quirky pitfalls. E.g some pdf readers won't open files form mounted file systems.

I'm not aware if there is a way to change/set the path where eclipse will extract it's temporary files, but if you're interested in such a use case, you are welcome to find the code and come up with a patch for this. Here is a resource that explains how OSGi deals with native files:
https://bnd.bndtools.org/chapters/390-wrapping.html

SWT has a file called Library.java that deals with loading of the natives. You can see how it functions.

Closing the bug for now, but feel free to re-open if we can help further.