RFCOMM not releasing properly

Bug #1428548 reported by Peyrega
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Raspbian
New
Undecided
Unassigned

Bug Description

I'm using stock raspian updated to lastest version on a raspberry pi 2 (1GB) device, together with a Inateck BTA-CSR4B5 bluetooth adapter.
The goal is to do serial communication over bluetooth.
Device are paired and I can achieve the communication properly with commands :

sudo rfcomm listen rfcomm0 1

upon deconnection (e.g. from the remote side), issueing the same command again fails to allow the remote side to reconnect.
If I first type :

sudo hciconfig hci0 reset

and then reissue the rfcomm listen command, it starts working again...

However, from time to time, this stops working completely, I get an error message :

Can't bind RFCOMM socket: Address already in use

and the result of dmesg shows the following :

[ 82.996877] ------------[ cut here ]------------
[ 82.996931] WARNING: CPU: 0 PID: 32 at drivers/tty/tty_port.c:144 tty_port_destructor+0x80/0x88()
[ 82.996944] Modules linked in: rfcomm snd_bcm2835 snd_pcm snd_seq snd_seq_device snd_timer snd ecb btusb evdev joydev bluetooth rfkill uio_pdrv_genirq uio
[ 82.997044] CPU: 0 PID: 32 Comm: kworker/0:1 Not tainted 3.18.8-v7+ #764
[ 82.997066] Workqueue: events release_one_tty
[ 82.997111] [<80016070>] (unwind_backtrace) from [<80012938>] (show_stack+0x20/0x24)
[ 82.997142] [<80012938>] (show_stack) from [<8051b1f0>] (dump_stack+0x98/0xd8)
[ 82.997216] [<8051b1f0>] (dump_stack) from [<800243e8>] (warn_slowpath_common+0x7c/0xa0)
[ 82.997246] [<800243e8>] (warn_slowpath_common) from [<800244c8>] (warn_slowpath_null+0x2c/0x34)
[ 82.997277] [<800244c8>] (warn_slowpath_null) from [<80322b48>] (tty_port_destructor+0x80/0x88)
[ 82.997335] [<80322b48>] (tty_port_destructor) from [<80322b9c>] (tty_port_put+0x4c/0x50)
[ 82.997395] [<80322b9c>] (tty_port_put) from [<7f159f10>] (rfcomm_tty_cleanup+0x5c/0x60 [rfcomm])
[ 82.997452] [<7f159f10>] (rfcomm_tty_cleanup [rfcomm]) from [<80318fd0>] (release_one_tty+0x3c/0xa0)
[ 82.997482] [<80318fd0>] (release_one_tty) from [<80039a50>] (process_one_work+0x138/0x408)
[ 82.997510] [<80039a50>] (process_one_work) from [<8003a494>] (worker_thread+0x4c/0x4d0)
[ 82.997535] [<8003a494>] (worker_thread) from [<8003ebc4>] (kthread+0xe0/0xfc)
[ 82.997586] [<8003ebc4>] (kthread) from [<8000eb88>] (ret_from_fork+0x14/0x20)
[ 82.997603] ---[ end trace 0d5fd4688197372d ]---

which looks like there is a crash in some destuctor (old C++ souvenirs...)

rfcomm -a

shows

rfcomm0: 00:1A:7D:DA:71:13 -> 40:2C:F4:DB:C9:73 channel 1 closed [reuse-dlc release-on-hup ]

This is quite reproducible, and while googling around, I found a few links that show similar things :

https://bugzilla.redhat.com/show_bug.cgi?id=1075265

I'm quite new to bug repports and be happy to provide missing information that could help spotting and solving this.
Regards

Revision history for this message
Peyrega (mathieu-peyrega-d) wrote :

it seems that a proposed patch (not sure this is related, but I would think so)

https://groups.google.com/forum/#!topic ... GQKKO37epg

is not applied in current raspian version :

https://github.com/raspberrypi/linux/bl ... tty_port.c
where the reported (supposed ?) buggy source code is the unpatched version

Revision history for this message
Jim Sievert (james-sievert) wrote :
Download full text (3.9 KiB)

I also found that an rfcomm device was not properly released. I see the following in dmesg:

Nov 4 17:24:22 live kernel: [75732.976759] ------------[ cut here ]------------
Nov 4 17:24:22 live kernel: [75732.976793] WARNING: CPU: 2 PID: 47 at /build/linux-rwKq_7/linux-3.13.0/drivers/tty/tty_port.c:145 tty_port_destructor+0x83/0x90()
Nov 4 17:24:22 live kernel: [75732.976803] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat ipt_REJECT xt_CHECKSUM iptable_mangle bridge stp llc ip6table_filter ip6_tables ebtable_nat ebtables xt_owner nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack xt_tcpudp iptable_filter ip_tables x_tables autofs4 dm_crypt arc4 iwlmvm(OX) mac80211(OX) snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm dm_multipath intel_rapl kvm_intel scsi_dh snd_page_alloc kvm snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul crc32_pclmul snd_seq ghash_clmulni_intel cryptd snd_seq_device snd_timer iwlwifi(OX) snd btusb(OX) rfcomm(OX) btbcm(OX) btintel(OX) bnep(OX) cfg80211(OX) cmac soundcore shpchp bluetooth(OX) compat(OX) i2c_scmi parport_pc ppdev lp mac_hid parport i2c_dev coretemp nfsd auth_rpcgss nfs_acl nfs lockd sunrpc fscache squashfs overlayfs nls_iso8859_1 hid_generic usbhid hid usb_storage igb dca ahci ptp i915(OX) pps_core sdhci_pci drm_mipi_dsi(OX) i2c_algo_bit drm_kms_helper(OX) sdhci libahci drm(OX) video(OX)
Nov 4 17:24:22 live kernel: [75732.977143] CPU: 2 PID: 47 Comm: kworker/2:1 Tainted: G OX 3.13.0-54-generic #0
Nov 4 17:24:22 live kernel: [75732.977154] Hardware name: N/A N/A/COMe-cBTi6R, BIOS BSCIA_PLX041.105.E38 X64 07/28/2015
Nov 4 17:24:22 live kernel: [75732.977173] Workqueue: events release_one_tty
Nov 4 17:24:22 live kernel: [75732.977184] 0000000000000009 ffff880273bb7d60 ffffffff817232a4 0000000000000000
Nov 4 17:24:22 live kernel: [75732.977207] ffff880273bb7d98 ffffffff8106784d ffff8801f438c56c ffff8801f438c400
Nov 4 17:24:22 live kernel: [75732.977227] ffff88027281bc00 0000000000000000 0000000000000080 ffff880273bb7da8
Nov 4 17:24:22 live kernel: [75732.977248] Call Trace:
Nov 4 17:24:22 live kernel: [75732.977273] [<ffffffff817232a4>] dump_stack+0x45/0x56
Nov 4 17:24:22 live kernel: [75732.977295] [<ffffffff8106784d>] warn_slowpath_common+0x7d/0xa0
Nov 4 17:24:22 live kernel: [75732.977314] [<ffffffff8106792a>] warn_slowpath_null+0x1a/0x20
Nov 4 17:24:22 live kernel: [75732.977333] [<ffffffff81455d33>] tty_port_destructor+0x83/0x90
Nov 4 17:24:22 live kernel: [75732.977351] [<ffffffff8145664c>] tty_port_put+0x2c/0x30
Nov 4 17:24:22 live kernel: [75732.977396] [<ffffffffa04460c8>] rfcomm_tty_cleanup+0x68/0x70 [rfcomm]
Nov 4 17:24:22 live kernel: [75732.977417] [<ffffffff8144b4d4>] release_one_tty+0x34/0xc0
Nov 4 17:24:22 live kernel: [75732.977439] [<ffffffff81083b22>] process_one_work+0x182/0x450
Nov 4 17:24:22 live kernel: [75732.977459] [<ffffffff81084911>] worker_thread+0x121/0x410
Nov 4 17:24:22 live kernel: [75732.977479] [<ffffffff810847f0>] ? rescuer_thread+0x430/0x430
Nov 4 17:24:22 live kernel: [75732.977498] [<ffffffff8108b702>] kthread+0xd2/0xf0
Nov 4 17:24:22 live kernel: [75732.977518] [<ffffffff...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.