Bug 95304

Summary: [PATCH] mbm: clear the previous poll timeout if we override it
Product: ModemManager Reporter: Lubomir Rintel <lkundrak>
Component: generalAssignee: ModemManager bug user <modemmanager>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch 1/1

Description Lubomir Rintel 2016-05-06 17:32:42 UTC
Created attachment 123524 [details]
Patch 1/1

If activate_ready() fires during another poll, it will loose the source id of
the old poll:

  ModemManager[12444]: <debug> [1462470508.486898] [mm-port-serial.c:1288] mm_port_serial_open(): (ttyACM0) device open count is 2 (open)
  ModemManager[12444]: <debug> [1462470508.486949] [mm-port-serial-at.c:459] debug_log(): (ttyACM0): --> 'AT*ENAP?<CR>'
  ModemManager[12444]: <debug> [1462470508.499707] [mm-port-serial-at.c:459] debug_log(): (ttyACM0): <-- '<CR><LF>*ENAP:2,""<CR><LF>'
  ModemManager[12444]: <debug> [1462470508.500711] [mm-port-serial-at.c:459] debug_log(): (ttyACM0): <-- '<CR><LF>OK<CR><LF>'
  ModemManager[12444]: <debug> [1462470508.500785] [mm-port-serial.c:1345] _close_internal(): (ttyACM0) device open count is 1 (close)
  ModemManager[12444]: <debug> [1462470509.486911] [mm-port-serial.c:1288] mm_port_serial_open(): (ttyACM0) device open count is 2 (open)
  ModemManager[12444]: <debug> [1462470509.486991] [mm-port-serial-at.c:459] debug_log(): (ttyACM0): --> 'AT*ENAP?<CR>'
  ModemManager[12444]: <debug> [1462470509.489002] [mm-base-bearer.c:874] mm_base_bearer_disconnect(): Disconnecting bearer '/org/freedesktop/ModemManager1/Bearer/83'
  ModemManager[12444]: <info>  [1462470509.489058] [mm-iface-modem.c:1431] __iface_modem_update_state_internal(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> disconnecting)

  (ModemManager:12444): GLib-CRITICAL **: g_source_remove: assertion 'tag > 0' failed
  [Thread 0x7ffff3ba3700 (LWP 12449) exited]

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x7ffff6ab502e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd4b0) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  Missing separate debuginfos, use: debuginfo-install libmbim-1.12.4-2.el7.centos.x86_64 libqmi-1.14.2-1.el7.centos.x86_64
  (gdb) bt
  #0  0x00007ffff6a508c3 in g_logv (log_domain=0x7ffff6ab502e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd4b0) at gmessages.c:1046
  #1  0x00007ffff6a50a3f in g_log (log_domain=log_domain@entry=0x7ffff6ab502e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7ffff6abe73d "%s: assertion '%s' failed") at gmessages.c:1079
  #2  0x00007ffff6a50a79 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7ffff6ab502e "GLib", pretty_function=pretty_function@entry=0x7ffff6abcbb0 <__FUNCTION__.12326> "g_source_remove", expression=expression@entry=0x7ffff6abc040 "tag > 0") at gmessages.c:1088
  #3  0x00007ffff6a485fa in g_source_remove (tag=<optimized out>) at gmain.c:2235
  #4  0x00007ffff237e9a1 in connect_cancelled_cb (cancellable=0x7fffe4011480 [GCancellable], self=0x7fffe40087a0 [MMBroadbandBearerMbm]) at mbm/mm-broadband-bearer-mbm.c:188
  #5  0x00007ffff6d47067 in _g_closure_invoke_va (closure=closure@entry=0x555555934540, return_value=return_value@entry=0x0, instance=instance@entry=0x7fffe4011480, args=args@entry=0x7fffffffd7a0, n_params=0, param_types=0x0) at gclosure.c:831
  #6  0x00007ffff6d5fb27 in g_signal_emit_valist (instance=0x7fffe4011480, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd7a0) at gsignal.c:3218
  #7  0x00007ffff6d6077f in g_signal_emit (instance=instance@entry=0x7fffe4011480, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3365
  #8  0x00007ffff6fc0425 in g_cancellable_cancel (cancellable=0x7fffe4011480 [GCancellable]) at gcancellable.c:508
  #9  0x000055555559c372 in mm_base_bearer_disconnect (self=0x7fffe40087a0 [MMBroadbandBearerMbm], callback=0x55555559c430 <handle_disconnect_ready>, user_data=0x555555928100) at mm-base-bearer.c:883
  #10 0x000055555559c534 in handle_disconnect_auth_ready (modem=0x5555559002b0 [MMBroadbandModemMbm], res=0x55555591e110, ctx=0x555555928100) at mm-base-bearer.c:947
  #11 0x00007ffff6ff9f47 in g_simple_async_result_complete (simple=0x55555591e110 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #12 0x00005555555a737a in authorize_ready (authp=0x5555558a4480 [MMAuthProvider], res=0x7fffe400b160, simple=0x55555591e110 [GSimpleAsyncResult]) at mm-base-modem.c:1161
  #13 0x00007ffff6ff9f47 in g_simple_async_result_complete (simple=0x7fffe400b160 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #14 0x00007ffff6ff9fa9 in complete_in_idle_cb (data=<optimized out>) at gsimpleasyncresult.c:775
  #15 0x00007ffff6a4979a in g_main_context_dispatch (context=0x5555558a4a00) at gmain.c:3109
  #16 0x00007ffff6a4979a in g_main_context_dispatch (context=context@entry=0x5555558a4a00) at gmain.c:3708
  #17 0x00007ffff6a49ae8 in g_main_context_iterate (context=0x5555558a4a00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3779
  #18 0x00007ffff6a49dba in g_main_loop_run (loop=0x5555558a4130) at gmain.c:3973
  #19 0x000055555558d068 in main (argc=2, argv=0x7fffffffdc38) at main.c:181
  (gdb)
Comment 1 Dan Williams 2016-05-11 18:23:28 UTC
I don't think the patch is quite right; there shouldn't ever be more than one poll in-flight at a given time.  But besides that, the connect paths are pretty complicated and they can be a lot simpler.

Please review: dcbw/mbm-connect-disconnect-cleanup
Comment 2 Dan Williams 2016-05-27 17:44:25 UTC
Merged branch after review from Aleksander.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.