Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gammu has different behaviour when running under strace

Tags:

strace

gammu

I am attempting to debug Gammu, a "library and command line utility for mobile phones", which is "timing out" when communicating normally with the modem.

gammu identify -> No response in specified timeout. Probably phone not connected.

Looking at the extra debug information it produces, for some reason, it's not "recognising" the response that the modem IS giving (given it has the correct responses when dialing the AT commands over a manual serial terminal).

However, my question is primarily about running the SAME PROGRAM under strace, where it has no problems, and does not timeout.

strace -e trace=open,close,read,write gammu identify -> (whole bunch of information about the modem)

What does/would strace be doing that would be causing this difference in behaviour? How does strace affect its child processes?

(Running on Ubuntu 18.04, Gammu 1.39.0)

like image 537
coiax Avatar asked Feb 01 '19 09:02

coiax


1 Answers

I have seen this kind of behavior in different platforms. sometime code runs successfully in debugging. it means because of debugging all code works slower and because of that user does not get timeout. example

makeSomeCallToServerOrPhone();
if(noResponseIn(5))
  throw new TimeOutException();

application will throw exception in 5 milliseconds if there is no response from server. in debugging, this will work because when you run your code step by step. server will respond in time and all will work. but in normal run, that 5 milliseconds is very small and server or phone may not respond in time there you get the exception.

strace also runs program more under control like debugging and slower. and because of that gammu looks like working. probably you can give gammu configuration and change timeouts check https://wammu.eu/docs/manual/smsd/config.html

like image 57
ozkanpakdil Avatar answered Oct 27 '22 11:10

ozkanpakdil