[BUG] CM9/CM10 Data connectivity bug - unFIXED, it seems

SlugZero

Member
Sep 11, 2012
38
647
0
I did some investigation on that bug the last few weeks and here is what I came up with based on my findings and what others have posted in this thread previously:

  • The bug seems to be somewhere inside the Motorola RIL implementation and appears to be present in all available RIL versions, i.e. there is no way to fix it
  • I believe the bug is also present in stock ROMs, but they recover automatically within at most a couple of minutes
  • The built-in data connection recovery in CM9/10 does not play well with the Defy, but it can be modified easily
  • With a slightly modified version of Quarx's ROM, I have fairly stable connectivity for one week now (longest dropouts around 2 to 3 minutes) and none that required toggling mobile data or flight mode. With a stock GB Defy+, I have temporary dropouts of similar length in my area. Without the patch I had dropouts almost every hour in some areas.

Here are some more details on what I figured:

The data connection seems to go down but the RIL implementation does not send any event to notify us. We therefore assume that data is still connected. It seems to be common that something like this happens, therefore there is a OnDataStallAlarm function that is called periodically to check if the connection is still alive. It does this by counting the number of sent packages and the number of received answers, assuming that something is broken if you do not get any data packets back for a while.
As soon as a data stall is detected, this routine starts a whole cascade of recovery actions.

However for our bug, these recovery functions get never activated because the number of sent packages is also not increasing any more. The simple solution I found is just to send a notification for a data connection change if there was no traffic at all during the last cycle.
This does not hurt because if the connection was still alive, this notification should do nothing. However if the connection was lost previously, it triggers a reconnect. I compared the connection tracker to older versions of Android, and it even seems like in older Android versions, this was done periodically to work around bad RIL implementations that did not report connectivity loss properly.

I think that this portion of the code (the connection recovery) was significantly modified from Android 2.6 to 4.0, and it probably did the recovery properly in earlier versions. This is why there were no persistent data connection dropouts although the actual RIL bug probably always has been there.

I attached my patched version of /system/framework/framework.jar which should work with Quarx's 0903 MB525 build (I suppose you know what you're doing when using this file, but in case you get stuck on boot, you can always go back to one of Quarx's ROMs by reflashing) and a patch for the source code.

I am sure there is a more elegant way to work around this bug and fix the data stall alarm, but at least I hope this is pointing to the right direction..

Edit: Patch is integrated in latest Quarx 12.09 build, no need to apply it manually any more :)
 

Attachments

Last edited:

ktmbikerman

Senior Member
May 7, 2011
1,990
656
0
51
Cape Town
I did some investigation on that bug the last few weeks and here is what I came up with based on my findings and what others have posted in this thread previously:

  • The bug seems to be somewhere inside the Motorola RIL implementation and appears to be present in all available RIL versions, i.e. there is no way to fix it
  • I believe the bug is also present in stock ROMs, but they recover automatically within at most a couple of minutes
  • The built-in data connection recovery in CM9/10 does not play well with the Defy, but it can be modified easily
  • With a slightly modified version of Quarx's ROM, I have fairly stable connectivity for one week now (longest dropouts around 2 to 3 minutes) and none that required toggling mobile data or flight mode. With a stock GB Defy+, I have temporary dropouts of similar length in my area. Without the patch I had dropouts almost every hour in some areas.

Here are some more details on what I figured:

The data connection seems to go down but the RIL implementation does not send any event to notify us. We therefore assume that data is still connected. It seems to be common that something like this happens, therefore there is a OnDataStallAlarm function that is called periodically to check if the connection is still alive. It does this by counting the number of sent packages and the number of received answers, assuming that something is broken if you do not get any data packets back for a while.
As soon as a data stall is detected, this routine starts a whole cascade of recovery actions.

However for our bug, these recovery functions get never activated because the number of sent packages is also not increasing any more. The simple solution I found is just to send a notification for a data connection change if there was no traffic at all during the last cycle.
This does not hurt because if the connection was still alive, this notification should do nothing. However if the connection was lost previously, it triggers a reconnect. I compared the connection tracker to older versions of Android, and it even seems like in older Android versions, this was done periodically to work around bad RIL implementations that did not report connectivity loss properly.

I think that this portion of the code (the connection recovery) was significantly modified from Android 2.6 to 4.0, and it probably did the recovery properly in earlier versions. This is why there were no persistent data connection dropouts although the actual RIL bug probably always has been there.

I attached my patched version of /system/framework/framework.jar which should work with Quarx's 0903 MB525 build (I suppose you know what you're doing when using this file, but in case you get stuck on boot, you can always go back to one of Quarx's ROMs by reflashing) and a patch for the source code.

I am sure there is a more elegant way to work around this bug and fix the data stall alarm, but at least I hope this is pointing to the right direction..
Looks very promising... thanks so much for your efforts!

I'm on Quarx 0904 MB526 build, although I'm not sure if the framework is any different? I'll give it a try anyway.

To all those who try the fix, please give feedback.

Thanks
 

phobos_1984

Senior Member
Apr 17, 2012
117
26
48
IMOLA
Hi to all!

Installing "sim unlock" worsen my situation. Now the connection drops are really frequent. I'm on the last (04/09) Quarx build.

By the way, how I uninstall a .zip package? If I reainstall the build again, will it remove it or just over write and leave all the added .zips?
 

ktmbikerman

Senior Member
May 7, 2011
1,990
656
0
51
Cape Town
Looks very promising... thanks so much for your efforts!

I'm on Quarx 0904 MB526 build, although I'm not sure if the framework is any different? I'll give it a try anyway.

To all those who try the fix, please give feedback.

Thanks
OK, I installed the framework.jar on my MB526, 0409 build and it seems to be all fine... just copied the framework.jar file to system/framework/ and set the permissions to rwx rxx rxx

I've disable Connection Checker, so I'll be able to in time if this fix works for me too
 

ktmbikerman

Senior Member
May 7, 2011
1,990
656
0
51
Cape Town
Hi to all!

Installing "sim unlock" worsen my situation. Now the connection drops are really frequent. I'm on the last (04/09) Quarx build.

By the way, how I uninstall a .zip package? If I reainstall the build again, will it remove it or just over write and leave all the added .zips?
If you install the cm10 zip again it should get rid of the sim unlock zip.
 
  • Like
Reactions: phobos_1984

gamerxxxn

Member
Aug 8, 2012
33
3
0
Mumbai
There seems to be various types of data drops, as seen by me on all forums,most people's signal bar just turns grey and an airplane mode toggle seems to fix it for them. However for me,the bar remains blue however the connection is stuck in the upward arrow sign and no downward arror sign comes,and airplane mode doesnt do anything ,i just have to reboot to make it proper.
 

ktmbikerman

Senior Member
May 7, 2011
1,990
656
0
51
Cape Town
There seems to be various types of data drops, as seen by me on all forums,most people's signal bar just turns grey and an airplane mode toggle seems to fix it for them. However for me,the bar remains blue however the connection is stuck in the upward arrow sign and no downward arror sign comes,and airplane mode doesnt do anything ,i just have to reboot to make it proper.
Are you sure you're using the correct baseband?
 

AnTerNoZ

Senior Member
Jan 14, 2011
888
558
123
Hiddenhausen
...
I attached my patched version of /system/framework/framework.jar which should work with Quarx's 0903 MB525 build (I suppose you know what you're doing when using this file, but in case you get stuck on boot, you can always go back to one of Quarx's ROMs by reflashing) and a patch for the source code.

I am sure there is a more elegant way to work around this bug and fix the data stall alarm, but at least I hope this is pointing to the right direction..
NICE WORK!

i think it worked great, don't had such big problems as without the patched framework.jar on latest Quarx build 0409.

have made a update zip with ur framework patch for those users that dont want to-do it manual (such lazy ppl like me)
 

Attachments

Last edited:

SeneKa82

Member
May 4, 2011
38
13
0
Tui
SlugZero's patch is working very well for me, no disconnections in 2h!!! :laugh::laugh::laugh:

I'm using CM10 experimental (04/09) on MB525 + patch.

Thanks!!!

PD: please somebody send this patch to Quarx.
 
  • Like
Reactions: ktmbikerman

royale1223

Senior Member
Oct 31, 2011
466
682
0
Calicut
I did some investigation on that bug the last few weeks and here is what I came up with based on my findings and what others have posted in this thread previously:

  • The bug seems to be somewhere inside the Motorola RIL implementation and appears to be present in all available RIL versions, i.e. there is no way to fix it
  • I believe the bug is also present in stock ROMs, but they recover automatically within at most a couple of minutes
  • The built-in data connection recovery in CM9/10 does not play well with the Defy, but it can be modified easily
  • With a slightly modified version of Quarx's ROM, I have fairly stable connectivity for one week now (longest dropouts around 2 to 3 minutes) and none that required toggling mobile data or flight mode. With a stock GB Defy+, I have temporary dropouts of similar length in my area. Without the patch I had dropouts almost every hour in some areas.

Here are some more details on what I figured:

The data connection seems to go down but the RIL implementation does not send any event to notify us. We therefore assume that data is still connected. It seems to be common that something like this happens, therefore there is a OnDataStallAlarm function that is called periodically to check if the connection is still alive. It does this by counting the number of sent packages and the number of received answers, assuming that something is broken if you do not get any data packets back for a while.
As soon as a data stall is detected, this routine starts a whole cascade of recovery actions.

However for our bug, these recovery functions get never activated because the number of sent packages is also not increasing any more. The simple solution I found is just to send a notification for a data connection change if there was no traffic at all during the last cycle.
This does not hurt because if the connection was still alive, this notification should do nothing. However if the connection was lost previously, it triggers a reconnect. I compared the connection tracker to older versions of Android, and it even seems like in older Android versions, this was done periodically to work around bad RIL implementations that did not report connectivity loss properly.

I think that this portion of the code (the connection recovery) was significantly modified from Android 2.6 to 4.0, and it probably did the recovery properly in earlier versions. This is why there were no persistent data connection dropouts although the actual RIL bug probably always has been there.

I attached my patched version of /system/framework/framework.jar which should work with Quarx's 0903 MB525 build (I suppose you know what you're doing when using this file, but in case you get stuck on boot, you can always go back to one of Quarx's ROMs by reflashing) and a patch for the source code.

I am sure there is a more elegant way to work around this bug and fix the data stall alarm, but at least I hope this is pointing to the right direction..
Great work. I just told quarx. You should better post this in the dev forum.

Sent from my MB525 using xda app-developers app
 
Last edited:

ktmbikerman

Senior Member
May 7, 2011
1,990
656
0
51
Cape Town
It works for me!

Not sure if anyone else has anything to feed back yet, but I have a pretty sure-fire way of testing this fix. I'm able to connect to 2 different networks and the phone is usually set to auto switch between the 2, this is where the disconnects happen. If I manually switch between the 2, I can force the switch and the disconnect, so I did this...

When the phone registered on the "second" network, the grey signal bars appeared and no up/down arrows could be seen i.e. the bug had shown it's nasty head... BUT, after a few seconds (about 30sec), the "H" disappeared momentarily, then reappeared and data started up again... SlugZero's fix works for me!!!

Any other feedback?
 

ktmbikerman

Senior Member
May 7, 2011
1,990
656
0
51
Cape Town
I see SlugZero was thanked by Quarx... very good chance that we'll have the fix in the next build I guess :D

Edit: The commit has just happened, woohoo!

Edit 2: I unlocked my phone and saw the dreaded grey signal bars, force of habit made me want to toggle Airplane mode, but I resisted the urge. Checked a few minutes later and they were blue again... the fix definitely works, as in the past this would never recover, Huge thanks to SlugZero!
 
Last edited:

htcmaxx

Member
Jul 13, 2010
16
1
0
testing patch on Defy+ Quarx nightly 2012-09-04 using Baseband 3.4.x in O2 Germany network (2G/3G auto)

I wonder whether it could have negative impact on battery usage.
 
Last edited:

hm9

Member
Dec 26, 2011
10
0
0
Tampico
Works on 2012/9/12 ??

i just update to 9/12+ Quarx on my 525 red lens, i apply the zip version and only gets loop on the cm10 intro... i flashed again the rom and starts usually (wipe cache/dalvik)

I don't know if the patch still or if i have to patch again... somebody already try on the recent nightly and tell us if this works as reported on 9/04 version?

Thanks
 

o_mas

Member
May 1, 2011
16
5
23
Madrid
I think 12.09 Quarx build already have this pach included and you don't need reflash it again...

12.09: Fixed touch driver (allow touches upto 10), Fix for data connection, thanks to SlugZero, also some more fixes for stability ril, disable fps limit in preview.
i just update to 9/12+ Quarx on my 525 red lens, i apply the zip version and only gets loop on the cm10 intro... i flashed again the rom and starts usually (wipe cache/dalvik)

I don't know if the patch still or if i have to patch again... somebody already try on the recent nightly and tell us if this works as reported on 9/04 version?

Thanks