BUG:检测到错误的解锁余额

时间:2014-10-06 09:46:30

标签: python linux

我尝试在linux上运行python脚本,我有以下错误:

[  590.744579] =====================================
[  590.749299] [ BUG: bad unlock balance detected! ]
[  590.754024] 3.12.13-fslc+g1cd7a83 #11 Not tainted
[  590.758741] -------------------------------------
[  590.763460] python/296 is trying to release lock (&tty->legacy_mutex) at:
[  590.770317] [<c042ff7c>] tty_unlock+0x20/0x54
[  590.774687] but there are no more locks to release!
[  590.779573]
[  590.779573] other info that might help us debug this:
[  590.786122] 2 locks held by python/296:
[  590.789966]  #0:  (&tty->ldisc_sem){++++++}, at: [<c042fd90>] tty_ldisc_lock_pair_timeout+0x74/0x124
[  590.799193]  #1:  (&tty->legacy_mutex/1){+.+.+.}, at: [<c0296eec>] tty_ldisc_release+0x20/0x70
[  590.807921]
[  590.807921] stack backtrace:
[  590.812310] CPU: 0 PID: 296 Comm: python Not tainted 3.12.13-fslc+g1cd7a83 #11
[  590.819609] [<c0014914>] (unwind_backtrace+0x0/0xe8) from [<c00120e4>] (show_stack+0x10/0x14)
[  590.828208] [<c00120e4>] (show_stack+0x10/0x14) from [<c0060db4>] (print_unlock_imbalance_bug+0xb0/0xe0)
[  590.837743] [<c0060db4>] (print_unlock_imbalance_bug+0xb0/0xe0) from [<c0065170>] (lock_release+0xb0/0x208)
[  590.847542] [<c0065170>] (lock_release+0xb0/0x208) from [<c042d2c8>] (__mutex_unlock_slowpath+0x7c/0x158)
[  590.857156] [<c042d2c8>] (__mutex_unlock_slowpath+0x7c/0x158) from [<c042ff7c>] (tty_unlock+0x20/0x54)
[  590.866511] [<c042ff7c>] (tty_unlock+0x20/0x54) from [<c029ce48>] (gsm_cleanup_mux+0xf8/0x22c)
[  590.875165] [<c029ce48>] (gsm_cleanup_mux+0xf8/0x22c) from [<c029d388>] (gsmld_close+0x48/0xa4)
[  590.883914] [<c029d388>] (gsmld_close+0x48/0xa4) from [<c0296630>] (tty_ldisc_close.isra.1+0x4c/0x64)
[  590.893179] [<c0296630>] (tty_ldisc_close.isra.1+0x4c/0x64) from [<c0296658>] (tty_ldisc_kill+0x10/0x88)
[  590.902702] [<c0296658>] (tty_ldisc_kill+0x10/0x88) from [<c0296ef4>] (tty_ldisc_release+0x28/0x70)
[  590.911791] [<c0296ef4>] (tty_ldisc_release+0x28/0x70) from [<c028ff00>] (tty_release+0x3c4/0x4f8)
[  590.920803] [<c028ff00>] (tty_release+0x3c4/0x4f8) from [<c00d4658>] (__fput+0x90/0x1f8)
[  590.928947] [<c00d4658>] (__fput+0x90/0x1f8) from [<c0037684>] (task_work_run+0xa8/0xbc)
[  590.937081] [<c0037684>] (task_work_run+0xa8/0xbc) from [<c001d804>] (do_exit+0x2a0/0x8ac)
[  590.945383] [<c001d804>] (do_exit+0x2a0/0x8ac) from [<c001edcc>] (do_group_exit+0x3c/0xb0)
[  590.953688] [<c001edcc>] (do_group_exit+0x3c/0xb0) from [<c001ee50>] (__wake_up_parent+0x0/0x18)

在这段代码中,我使用os.system("muxGWIO")启动了一个程序,后者用它的PID(我有一个搜索PID的函数)os.kill(PID, signal.SIGTERM)来杀死它。

你知道如何解决这个问题吗?

编辑:

我有更多信息: 我的muxGWIO程序创建了2个虚拟com端口(我使用GSM0710协议有2个虚拟com端口和一个真正的com端口)。这两个虚拟端口为/dev/ttyGSM1/dev/ttyGSM2

我在我的python脚本中使用它们:com=serial.Serial('/dev/ttyGSM1')

然后,稍后,我发布它们:com.close()

最后我杀了muxGWIO。当它被杀死时,muxGWIO删除ttyGSM1和ttyGSM2。

此时此错误出现了。

如果我评论com=serial.Serial('/dev/ttyGSM1')com.close()行,则不会再出现问题了。

我认为问题是python在杀死muxGWIO之前不解锁ttyGSM1。因此,当python脚本结束时,它会尝试释放ttyGSM1,但它不再存在。

你有解决方案吗?

0 个答案:

没有答案