lerno/naga

Opening a Socket crashes on Android

GoogleCodeExporter opened this issue · 5 comments

What steps will reproduce the problem?
1. Declare a NIOService and a NIOSocket.
2. Instantiate the NIOService, selectNonBlocking, then do 
service.openSocket(host,port)
3. The connection succeeds, then the Application force closes.

What is the expected output? What do you see instead?
Afther the connection, it should instantiate the SocketObserver, however, the 
application crashes right after the connection.

What version of the product are you using? On what operating system?
I am using Naga 3.0 along with the version 8 of Android API (or Android 2.2). 
I'm using the version 1.6 of OpenJDK and I'm coding on Ubuntu 12.04 x64.

Please provide any additional information below.
I'm going to try this with 2.1 version of Naga, and I'll keep you updated.

Original issue reported on code.google.com by rodolphe...@gmail.com on 2 Oct 2012 at 9:18

Attachments:

The same issue occurs with naga 2.1 (with event machine).

Original comment by rodolphe...@gmail.com on 2 Oct 2012 at 9:21

  • Added labels: ****
  • Removed labels: ****
This looks relevant: http://code.google.com/p/android/issues/detail?id=9431, 
basically a bug in Android 2.2.

Apparently a working workaround is:

java.lang.System.setProperty("java.net.preferIPv4Stack", "true");
java.lang.System.setProperty("java.net.preferIPv6Addresses", "false");

Can you please verify this?

Original comment by christof...@gmail.com on 2 Oct 2012 at 3:47

  • Changed state: Accepted
  • Added labels: ****
  • Removed labels: ****

Hi (since I forgot to say it in my previous copy/paste),

I'm home for now, I'll try this out ASAP and keep you updated. If it doesn't 
work, I guess I'll backport my app to 2.1.

By the way, thank you for your quick answer.

Original comment by rodolphe...@gmail.com on 2 Oct 2012 at 4:42

  • Added labels: ****
  • Removed labels: ****
Hi,

I just tried the workaround you've provided me, and that works!

Thank you very much for your help, and also for this library.

Original comment by rodolphe...@gmail.com on 3 Oct 2012 at 8:36

  • Added labels: ****
  • Removed labels: ****
Good, I'm closing this as invalid, since the bug actually is in Android.

Original comment by christof...@gmail.com on 3 Oct 2012 at 9:46

  • Changed state: Invalid
  • Added labels: ****
  • Removed labels: ****