Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incoming SMS on a SIM800C USB modem will crash #53

Open
ocalvo opened this issue Sep 23, 2021 · 6 comments
Open

Incoming SMS on a SIM800C USB modem will crash #53

ocalvo opened this issue Sep 23, 2021 · 6 comments

Comments

@ocalvo
Copy link
Contributor

ocalvo commented Sep 23, 2021

When using SMS callbacks with a SIM800C modem, the call to ReadDevice crash the process:

gammu/src/gammu.c:430

Fatal Python error: Segmentation fault

Current thread 0x00007fd295440700 (most recent call first):
  File "/mnt/s/dd/Repos/ha/core/homeassistant/components/sms/gateway.py", line 44 in sms_pull
  File "/mnt/s/dd/Repos/ha/core/venv/lib/python3.8/site-packages/python_gammu-3.2.3-py3.8-linux-x86_64.egg/gammu/worker.py", line 247 in run
  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap
(gdb) backtrace
#0  0x00000000005f26bb in PyObject_Call ()
#1  0x00007fffe12601fb in CheckIncomingEvents (sm=0x7fffe061c030) at gammu/src/gammu.c:430
#2  0x00007fffe1262790 in StateMachine_ReadDevice (self=0x7fffe061c030, args=<optimized out>, kwds=<optimized out>)
    at gammu/src/gammu.c:893
#3  0x0000000000504939 in ?? ()
#4  0x000000000056acb6 in _PyEval_EvalFrameDefault ()
#5  0x000000000050b6fe in ?? ()
#6  0x000000000056fb87 in _PyEval_EvalFrameDefault ()
#7  0x00000000005f5956 in _PyFunction_Vectorcall ()
#8  0x000000000056acb6 in _PyEval_EvalFrameDefault ()
#9  0x00000000005f5956 in _PyFunction_Vectorcall ()
#10 0x000000000056acb6 in _PyEval_EvalFrameDefault ()
#11 0x00000000005f5956 in _PyFunction_Vectorcall ()
#12 0x000000000050b7f8 in ?? ()
#13 0x00000000005f2702 in PyObject_Call ()
#14 0x000000000065578c in ?? ()
#15 0x0000000000675d48 in ?? ()
#16 0x00007fffff586609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007fffff6c2293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)

More info

(gdb) print *sm

$4 = {ob_base = {ob_refcnt = 5, ob_type = 0x7fffe127dca0 <StateMachineType>}, s = 0x7fffe0020010, DebugFile = 0x0,
  IncomingCallback = 0x0, SMSStatus = 0, MessageReference = 0, IncomingCallQueue = {0x0 <repeats 11 times>},
  IncomingSMSQueue = {0x0 <repeats 11 times>}, IncomingCBQueue = {0x0 <repeats 11 times>}, IncomingUSSDQueue = {
    0x0 <repeats 11 times>}, memory_entry_cache_type = 0, memory_entry_cache = 1, todo_entry_cache = 1,
  calendar_entry_cache = 1, mutex = 0x19534e0}
@nijel
Copy link
Member

nijel commented Sep 23, 2021

Having stack trace from the segfault would help. Most likely this is actually an issue in the Gammu library.

@ocalvo
Copy link
Contributor Author

ocalvo commented Sep 23, 2021

@nijel Where are the dumps? I have a system where I can repro this, but I dont know how to get the dump of stack trace.

@ocalvo
Copy link
Contributor Author

ocalvo commented Sep 24, 2021

I know how to get a dump, but I can only do it from my production system, but that system contains too many secrets.
I will try with a VM over the weekend.

@nijel
Copy link
Member

nijel commented Sep 27, 2021

See https://wiki.archlinux.org/title/Debugging/Getting_traces#Getting_the_trace for guide to get trace from the core dump.

@ocalvo
Copy link
Contributor Author

ocalvo commented Oct 3, 2021

See https://wiki.archlinux.org/title/Debugging/Getting_traces#Getting_the_trace for guide to get trace from the core dump.

I am using WSL 1.0 and it does not support core dumps. However I updated the issue with the callback info.

Gamma.c is referencing the null pointer of the callback function.

@nijel
Copy link
Member

nijel commented Oct 4, 2021

Looking at home-assistant/core#56552, the problem is probably in using Gammu functions from the callback, what is not safe. I'm not sure if this is somewhere documented, but it can definitely cause problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants