Re: [Bluez-users] Major slowdown when service discovery+opening a service happens on two systems trying to talk to each other

Marcel Holtmann
2004-02-20T23:14:53Z

Hi Marc-Andre,

> Here's the situation in more Bluetooth-compliant terms:
> Configuration:
> Belkin FT0003 USB dongles
> RedHat 9 with kernel 2.4.28, from RedHat
> Running with latest released versions of BlueZ
> Running Impronto 1.18
> Running Java SDK 1.4.2.3

I can't tell you anything about the Java part, but the kernel version
that you are using don't exists ;)

> Bluetooth activity (all happening in Java):
>
> Implicit: Inquiry Scan [device is set as GIAC]
> Thread 1: Inquiry [aka Device Discovery] [runs perpetually, with some sleeping
> between each iteration]
> Thread 2: Page Scan [opening a service and waiting for clients with
> acceptAndOpen()]
> Thread 3: SDP Paging + Connection [Service Discovery] [does so when new devices
> are found, could happen anytime. Sleeps most of the time]
> Thread 4: Paging + Connection [L2CAP Connection as a slave] [happens at user's
> input]
>
> Computer A and Computer B are running this configuration
> Planned Test:
> Start program on both computers
> Wait for both Computer A and Computer B to discover each other via Inquiry
> User prompts Computer A to send a message to Computer B [creating a L2CAP
> connection]
> Computer B reads the message and closes the connection
> Both shut down their services and exit cleanly
>
> What happens:
> Inconsistent behaviour. Service discovery can happen promptly on Computer A and
> never finish on Computer B. Sometimes, service discovery completes around 20
> seconds for both systems.
> The L2CAP connection may not establish itself. Behaviour varies at every test's
> run, but generally the results look like a deadlock has occured somewhere.
> Very low Bluetooth performance compared to the speed of other configurations.
>
> I hope this makes more sense. I have to read more about the Bluetooth spec, see
> what I'm doing wrong Bluetooth-wise. Any sections particularly?

The problem that I see is that if device A runs an inquiry and device B
tries to page device A at the same time, this will fail. But this is a
topic for baseband experts and not for me. You can try to disable page
scan before you run an inquiry and re-enable it when your are finished.
Same goes for the inquiry scan.