hudamalmsteen / csipsimple

Automatically exported from code.google.com/p/csipsimple
0 stars 0 forks source link

Lots of open SIP channels on Asterisk from csipsimple #962

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Connected over wlan via TCP.
2. Can make and receive calls.
3. I see periodic re-registrations in Android notification bar.
4. Eventually can't make calls.
5.Check * with" sip show channels" and there are 40 open sip channels from 
csipsimple, all are REGISTER and OPTIONS.
6. Restarting* and re-registering csipsimple allows me to make calls again.

What version of the product are you using? On what operating system?

r841 on Android 2.1 (rooted).

Original issue reported on code.google.com by sli...@gmail.com on 15 May 2011 at 2:44

GoogleCodeExporter commented 9 years ago
Host                           Port Transport   Type
95.23.186.143                  5100   TCP       Server
95.23.186.143                  48097  TCP       Server
95.23.186.143                  50716  TCP       Server
95.23.186.143                  55855  TCP       Server
95.23.186.143                  59337  TCP       Server
95.214.24.79                   38681  TCP       Server

.143 is csipsimple

Here are some of the channels (can't copy them all from my mobile SSH client):

95.23.186.143    (None)           3d5bc6a55f9dfc2  0x0 (nothing)    No  (d)  
Init: OPTIONS95.23.186.143    (None)           3aeccae168e1211  0x0 (nothing)   
 No  (d)  Init: OPTIONS
95.23.186.143    (None)           3aa683d3005419b  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           RkS8RSJo5XZWtcg  0x0 (nothing)    No       
Rx: REGISTER
95.23.186.143    (None)           48e3bfb330a97dd  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           278e5c3977c4212  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           jiLyDGPQHXdQ3k1  0x0 (nothing)    No       
Rx: REGISTER
95.23.186.143    (None)           0cc195c1465d5d2  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           5a1fae9813b868e  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           ac056cdd4cdd8d8  0x0 (nothing)    No       
Rx: REGISTER
95.23.186.143    (None)           WQ8yNFTjA2yLCju  0x0 (nothing)    No       
Rx: REGISTER
95.23.186.143    (None)           4e78c43423a644a  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           360c30bc6fba2d9  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           1db8c1ec1f38083  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           79fcc3b56cccba0  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           413e05097a99faa  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           6a03534a2ccd800  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           .t-8O7kOcFSUkyf  0x0 (nothing)    No       
Rx: REGISTER
95.23.186.143    (None)           23ec8f7152d520a  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           1856a672327eec2  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           751857a21010766  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           6513b55f142f346  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           030d9ef0254e14a  0x0 (nothing)    No  (d)  
Init: OPTIONS
95.23.186.143    (None)           0vNGaZwkauGULZ8  0x0 (nothing)    No       
Rx: REGISTER
52 active SIP dialogs
mops*CLI>

Original comment by sli...@gmail.com on 15 May 2011 at 2:56

GoogleCodeExporter commented 9 years ago
Sorry for the spam, just one more thing. I was watching the channels on 
asterisk for a few hours and there were one or two at most for csipsimple, then 
I checked again and there were suddenly 35, checked again a little later and 
there were 45 and they keep climbing.

Original comment by sli...@gmail.com on 15 May 2011 at 2:58

GoogleCodeExporter commented 9 years ago

There is some situations that could lead to this kind of increase of 
connections.

CSipSimple can be configured in several ways. You probably already noticed that 
but there is options to tell the app to be active only on wifi and to not 
retain the wifi lock for example.

The option you have is probably this one (available on wifi).

This option means that the application will leave the wifi to be disabled by 
the system (usually when the screen goes off). 
If no other app lock it, it will save battery. The thing is that in this case, 
CSipSimple get unregistered and suddently has no wifi anymore. As 
consequence... impossible to unregister and impossible to close the socket a 
clean way. Your server will have the socket in a weird state for a couple of 
minutes and will also think the client is still registered (obviously 
csipsimple was never able to unregister).

When the wifi is up again (if there is one app that do wifi things on your 
phone could occurs very often), CSipSimple re-register.

This could be the first explaination.

I've also seen other case on old devices running recent version of android. In 
this case, the RAM of the phone reach quickly it's top (all the more so as the 
user install a lot of app that use RAM). As consequence the android OS kill 
randomly apps. On the device I was able to observe this behavior all apps where 
affected. CSipSimple, Google Maps, Google Talk and so on. In this case, the 
android OS will automatically restart the app few minutes later. And you'll get 
the same problem than previously, sockets and registrations not cleanly closed 
by the app.

Unfortunately, in this case, there is really nothing I can do. In the first 
case, I could advise you to choose the "Always available" mode or to find the 
culprit app that keep restarting your wifi while the phone is going in wifi 
sleep mode.

Anyway, to determine which of the case it could be, what could be helpful for 
me would be to send me logs. See the HowToCollectLogs wiki page. 

Original comment by r3gis...@gmail.com on 15 May 2011 at 4:20

GoogleCodeExporter commented 9 years ago
Thats not a csipsimple issue, its an asterisk bug.
You can apply a patch for that, see 
https://issues.asterisk.org/view.php?id=17544

Original comment by marcello...@gmail.com on 15 May 2011 at 9:47

GoogleCodeExporter commented 9 years ago
I'm recording a log now which I'll send through soon.

I suspect it's not the first issue you suggested, as I see multiple 
registrations during one web browsing session, so the phone's not sleeping.

The second seems more likely. It's a Motorola Milestone so 2.1 is the Android 
version it came with (though I am running a custom 2.1 'ROM'). However I am 
seeing behaviour indicative of memory issues. I have seen some behaviour that 
suggests csipsimple might be using a lot of RAM though, as I *seem to* get more 
home screen reloads while using it. That's very unscientific though. I'll have 
a look around for an app to look at per-app memory usage. Unfortunately my ROM 
doesn't have procrank.

Also, this appears to be related:

https://issues.asterisk.org/view.php?id=17544&nbn=6

So the real issue is with Asterisk, but I think it's probably still worth 
investigating why the connections are being interrupted on csipsimple's end too.

Original comment by sli...@gmail.com on 16 May 2011 at 10:38

GoogleCodeExporter commented 9 years ago
Sorry Marcello, I didn't see your comment before posting mine.

Original comment by sli...@gmail.com on 16 May 2011 at 12:20

GoogleCodeExporter commented 9 years ago
Debug log sent.

Original comment by sli...@gmail.com on 16 May 2011 at 12:23

GoogleCodeExporter commented 9 years ago
It is not a commit of me, it was just a patch that closes other connections 
when some device do register.
The asterisk developers decided to set a timeout for tcp sockets, so threads 
will be close after some idle time.

Original comment by marcello...@gmail.com on 16 May 2011 at 12:43

GoogleCodeExporter commented 9 years ago
Yeah I saw that, which is why I posted it in my message too, I just hadn't 
noticed that you had already posted it here.

Original comment by sli...@gmail.com on 16 May 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Did you receive my log R3gis or should I re-send?

Original comment by sli...@gmail.com on 17 May 2011 at 12:56

GoogleCodeExporter commented 9 years ago
@sli... : no I didn't receive it. 
You sent using the email address that is automatically setup when you collect 
and send logs from the application?

Original comment by r3gis...@gmail.com on 17 May 2011 at 3:16

GoogleCodeExporter commented 9 years ago
Yes, developers@ iirc. I've just resent it to your gmail account.

Original comment by sli...@gmail.com on 18 May 2011 at 10:16

GoogleCodeExporter commented 9 years ago
Received, thanks :)

I'll investigate.

Original comment by r3gis...@gmail.com on 18 May 2011 at 10:54

GoogleCodeExporter commented 9 years ago
Latest nightly builds now tell the android system that the app should not be 
killed by the OS. So if should help with this issue. However, if the android os 
is very overloaded, it will still kill the app and you may still have the 
problem.
But in most cases it should help a lot.
The only thing required is to not remove the csipsimple notification : there is 
a setting that should be left to default, ie the app should appear in 
notification bar. If not actually the android OS consider the app has not the 
right to tell the system it is important for the user.

Original comment by r3gis...@gmail.com on 7 Nov 2011 at 10:48