robertoprato / bluecove

Automatically exported from code.google.com/p/bluecove
0 stars 0 forks source link

Thread endless loop when disconnect client from linux server #54

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. connect to a Linux self written server with L2CAP 
2. disconnect abruptly without sending a disconnect message
3. native thread will never stop -> java thread will not stop.

What is the expected output? What do you see instead?

In windows:
2008-11-16 22:56:46,187 DEBUG [Thread-10] <com.intel.bluetooth> receive[]
waits returns WAIT_OBJECT_0 
2008-11-16 22:56:46,187 DEBUG [Thread-10] <com.intel.bluetooth> will throw
exception java/io/IOException(Connection closed) 
2008-11-16 22:56:46,187 ERROR [Thread-10] <client.L2CAPPlayer>
java.io.IOException: Connection closed 

In linux:
2008-11-16 22:08:02,394 DEBUG [Thread-9] <com.intel.bluetooth> receive[]
returns 0 
2008-11-16 22:08:02,395 DEBUG [Thread-9] <com.intel.bluetooth> receive[]
returns 0 
2008-11-16 22:08:02,395 DEBUG [Thread-9] <com.intel.bluetooth> receive[]
returns 0 
-> endless loop.

Please use labels and text to provide additional information.

bluecove libs 2.0.3 (including the gpl lib)

Original issue reported on code.google.com by Yoav.Nor...@gmail.com on 17 Nov 2008 at 10:53

GoogleCodeExporter commented 8 years ago
When connection closed remotely the L2CAP receive should exist.

See the RFCOMM implementation
Java_com_intel_bluetooth_BluetoothStackBlueZ_connectionRfRead as example.

Original comment by skarzhev...@gmail.com on 17 Nov 2008 at 3:24

GoogleCodeExporter commented 8 years ago
Issue 55 has been merged into this issue.

Original comment by skarzhev...@gmail.com on 17 Nov 2008 at 3:24

GoogleCodeExporter commented 8 years ago
I think that Mina fixed the problem and Nightly BlueCove Build should contain 
the fix.

Original comment by skarzhev...@gmail.com on 9 Dec 2008 at 6:29

GoogleCodeExporter commented 8 years ago
it isn't completely fixed yet.
depending only on receive() method still produces the endless loop

only using L2CAPConnection.ready() before L2CAPConnection.receive() works!

I'll try to fix it completely soon.

Original comment by minasho...@gmail.com on 9 Dec 2008 at 10:39

GoogleCodeExporter commented 8 years ago
I made changes to code and it works for me. and it should work now.
Vlad, please review and change status again if issue still reproducible or if 
there
are another problems.

Original comment by minasho...@gmail.com on 9 Dec 2008 at 12:51

GoogleCodeExporter commented 8 years ago

Original comment by skarzhev...@gmail.com on 9 Dec 2008 at 4:45

GoogleCodeExporter commented 8 years ago
L2CAPConnection.receive still hangs when connection closed by host.

I think it's needed to check (fds.revents & POLLNVAL) in
Java_com_intel_bluetooth_BluetoothStackBlueZ_l2Receive and
Java_com_intel_bluetooth_BluetoothStackBlueZ_l2Ready

After applying this changes I get it working.

Best Regards,
Alexander

Original comment by exclusion on 23 Feb 2009 at 5:55

GoogleCodeExporter commented 8 years ago
Even so I can't reproduce the "hangs" problem I added handling for POLLNVAL.
Hope this will work fine now.
See the next build 2.1.1-SNAPSHOT.12 for fixed binaries.

Original comment by skarzhev...@gmail.com on 24 Feb 2009 at 8:19

GoogleCodeExporter commented 8 years ago

Original comment by skarzhev...@gmail.com on 26 Feb 2009 at 7:06