# wip\_bearerStart()... and then I break the WIP stack

**URL:** <https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989>\
**Category:** Open AT\
**Created:** [March 30, 2011, 11:01am UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989 "2011-03-30T11:01:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlreadyInUse](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@AlreadyInUse](https://forum.sierrawireless.com/u/AlreadyInUse)\
**Post date:** [March 30, 2011, 11:01am UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989/1 "2011-03-30T11:01:32Z")

</div>

Hi

I sometimes get the condition where wip\_bearerStart() returns -27 (in progress), but I never get any call-back to indicate success or failure. After 1 minute I grow tired of waiting and try to re-connect; I call wip\_bearerStop(), which also returns -27 and no further call-backs.

Calling wip\_bearerOpen() after this returns -21 (already open) and then wip\_bearerStart() returns -28 (bad state). Still wip\_bearerStop() returns -27.

If I call wip\_bearerClose() it returns 0 (OK). wip\_bearerOpen() now again returns 0, and wip\_bearerStart() returns -29 (Error from link layer initialization).

Herewhit some debug (not the standard traces I see on this forum, but betetr than nothing)

```auto
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_netInit() returns 0
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerOpen() returns 0
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach "ci.co.za", "", ""
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerSetOpts() returns 0
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerStart() returns -27
                                                              // in progress
[ADL_CALL_EVENT_NO_CARRIER]
...
(09:31:37.0) gsmctl: mx_gsmcontrolApnAttach TIMEOUT
(09:31:37.0) gsmctl: GSMTriggerCommand GCMD_CLOSE_APN
(09:31:38.0) gsmctl: GSMControl : CmdAct=1 CmdId=2 EngMode=1
(09:31:38.0) gsmctl: mx_gsmcontrolSocketClose socket already closed
(09:31:38.0) gsmctl: mx_gsmcontrolApnClose wip_bearerStop() returns -27
                                                            // in progress
...
(09:32:37.0) gsmctl: GSMTriggerCommand GCMD_APN_ATTACH
(09:32:38.0) gsmctl: GSMControl : CmdAct=1 CmdId=7 EngMode=1
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_netInit() returns 0
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerOpen() returns -21
                                                             // already open
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach "ci.co.za", "", ""
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerSetOpts() returns 0
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerStart() returns -28
                                                              // bad state
(09:32:38.0) gsmctl: GSMTriggerCommand GCMD_CLOSE_APN
(09:32:39.0) gsmctl: GSMControl : CmdAct=1 CmdId=2 EngMode=1
(09:32:39.0) gsmctl: mx_gsmcontrolSocketClose socket already closed
(09:32:39.0) gsmctl: mx_gsmcontrolApnClose wip_bearerStop() returns -27
                                                            // in progress
...
(09:39:53.2) testAt: wip_bearerClose() returns 0
...
(09:40:45.0) gsmctl: GSMTriggerCommand GCMD_APN_ATTACH
(09:40:46.0) gsmctl: GSMControl : CmdAct=1 CmdId=7 EngMode=1
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_netInit() returns 0
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerOpen() returns 0
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach "ci.co.za", "", ""
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerSetOpts() returns 0
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerStart() returns -29
                                                              // Error from link layer initialization
(09:40:46.0) gsmctl: GSMTriggerCommand GCMD_CLOSE_APN
(09:40:47.0) gsmctl: GSMControl : CmdAct=1 CmdId=2 EngMode=1
(09:40:47.0) gsmctl: mx_gsmcontrolSocketClose socket already closed
(09:40:47.0) gsmctl: mx_gsmcontrolApnClose wip_bearerStop() returns 0
```

My call back function prints debug upon entry, which I never receive, so I know I’m not missing the success/fail call-back.

This behaviour is only observed when the planets allign, and solar activity flares up (i.e. not very often, but enough to be problematic). The only way I can recover the WIP stack when this happes is to restart the module using AT+CFUN=1.

Has anybody seen this before? Is there any way to recover from this? Is there something I’m doing wrong, or something I can do to prevent this? Can the ADL\_CALL\_EVENT\_NO\_CARRIER call-back be any indication of what is happening?

Thanks

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [March 30, 2011, 11:17am UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989/2 "2011-03-30T11:17:42Z")

</div>

[https://forum.sierrawireless.com/t/start-and-stop-gprs-bearer-connection/4923/1](https://forum.sierrawireless.com/t/start-and-stop-gprs-bearer-connection/4923/1)

---

<div class="post-metadata">

**Author:** ![AlreadyInUse](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@AlreadyInUse](https://forum.sierrawireless.com/u/AlreadyInUse)\
**Post date:** [March 30, 2011, 1:12pm UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989/3 "2011-03-30T13:12:22Z")

</div>

Thanks for the quick reply. I read through the supplied thread and a few others as well. The issue in the above case was more related to not closing the bearer before trying to open it again. In my case, I simply never receive any call-backs after trying to start the bearer.

As mentioned, this behaviour only occurs occasionally; I cannot re-create it in a reliable fashion.

I suspect that I may be trying to start the bearer before the radio is ready. I wait for the SIM INIT FULL call-back before the rest of my state-machine is allowed to execute. I also do not attempt to start the GPRS bearer if I am not currently registered on either the Home network or a Roaming network.

Can you maybe suggest anything else I need to check before starting the bearer?

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [March 30, 2011, 2:08pm UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989/4 "2011-03-30T14:08:25Z")

</div>

> [@AlreadyInUse](#):
>
> The issue in the above case was more related to not closing the bearer before trying to open it again.

But it does point out that there are cases where the only recovery after a bearer loss/failure is to reboot.

> [@](#):
>
> Can you maybe suggest anything else I need to check before starting the bearer?

Home/Roaming registration should be sufficient.

---

<div class="post-metadata">

**Author:** ![AlreadyInUse](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@AlreadyInUse](https://forum.sierrawireless.com/u/AlreadyInUse)\
**Post date:** [March 30, 2011, 2:20pm UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989/5 "2011-03-30T14:20:19Z")

</div>

> [@](#):
>
> But it does point out that there are cases where the only recovery after a bearer loss/failure is to reboot.

☹ I was hoping to avoid restarting the module.

> [@](#):
>
> Home/Roaming registration should be sufficient.

This is not the thread to discuss this, but I have found that the module keeps reporting that it is registered on the Home network, even after I know that it has dropped off. (Tests involved a GSM jamming device 😈) So it might still be the case that, at the time I try to start the bearer and break the WIP stack, I am in fact not registered.

For now I will restart the module when this happens.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [March 30, 2011, 3:19pm UTC](https://forum.sierrawireless.com/t/wip-bearerstart-and-then-i-break-the-wip-stack/4989/6 "2011-03-30T15:19:53Z")

</div>

> [@AlreadyInUse](#):
>
> I know that it has dropped off. (Tests involved a GSM jamming device 😈)

Maybe the jamming device was not totally effective, so the unit was able to remain registered - even though unable to do anything useful?

Much like a phone will claim to be registered in a very poor signal location, but will fail as soon as you try to make a call…

These do seem to be the kinds of situations in which WIP is prone to get itself into a mess that needs a restart to resolve…
