pjmedia bind error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SO_REUSEADDR may solve your problem indeed, but it's not the correct
solution. Especially for UDP sockets, as it may kill off other process
which happens to bind to the same port. So IMO you need to have better
port management for your app.

Best regards,
?Benny


On Wed, Sep 15, 2010 at 6:33 PM, Parveen Kumar Jain
<parveen.jain at one97.net> wrote:
> Benny,Hassan,
> ??Any feedback on this ?
> ?pjmedia is a diversified project and several of users might feel this patch
> needed.Let me know if I didn't clarify anything which you needed.
> Regards,
> Parveen Jain
>
> On Mon, Sep 6, 2010 at 11:46 AM, Parveen Kumar Jain <parveen.jain at one97.net>
> wrote:
>>
>> Hi All,
>> ?Following are the changes in transport_udp.c.(the file path is
>> pjmedia/src/pjmedia/transport_udp.c)
>> "int reuse = 1;
>> if (setsockopt(si.rtp_sock, SOL_SOCKET, SO_REUSEADDR,(char *)&reuse,
>> sizeof(reuse)) < 0)
>> {
>> perror("Setting SO_REUSEADDR error");
>> PJ_LOG(4, (THIS_FILE,"setsockopt SO_REUSEADDR ?socket %d Error:
>> %s",si.rtp_sock,strerror(errno)));
>> }"
>> I am putting this after opening the socket, i.e at line no. 223 in
>> function "pjmedia_transport_udp_create3".
>> Let me know if you want the changed files, I will provide the same.
>> After this I had checked it for load testing of 300 calls per second(my
>> testing continued for several hours in this way) and never faced that issue
>> again.
>> Though I am facing another bottleneck again, I am not able to take it
>> beyond 300 call per second.Whenever I try to run it for 400 calls(even with
>> PCMU calls) per second it crashes after 1-2 hours of testing.I know CPU
>> power is not the limitation, as in this way of running it hardly touches 1/5
>> of total CPU capacity present in the system.I have the feeling that there is
>> something in code itself(either some ?"#define" or something) which is
>> inhibiting to scale it up to that level.Let me know if any one can help me
>> to improve this.
>> Best Regards,
>> Parveen Jain
>>
>>
>> On Tue, Aug 31, 2010 at 3:28 PM, Nyamul Hassan <mnhassan at usa.net> wrote:
>>>
>>> A source would be very helpful. ?Thx in advance.
>>> Regards
>>> HASSAN
>>>
>>> On Tue, Aug 31, 2010 at 15:43, Parveen Kumar Jain
>>> <parveen.jain at one97.net> wrote:
>>>>
>>>> Hi Benny,
>>>> ?I got the solution of the problem after digging through some socket
>>>> options.I found that "socket close" call returns immediately without
>>>> actually closing the socket; closing the socket in background.Because of
>>>> which if some application happen to call the bind request "close" and
>>>> "bind"(as was happening below here) in sequence and quickly(for same port)
>>>> it "may" return "Bind Error".
>>>> ??I fixed this by setting the socket option "REUSE_ADDR", now this
>>>> allows the socket to bind to same port without getting any error.and it can
>>>> allow the already bound socket to get closed?peacefully?without giving any
>>>> error to the next "bind" command.
>>>> Let me know if any one needs this, I can share the code changes for the
>>>> same.
>>>> (I found this as the most generic fixed which has been done even in
>>>> other open source "audio media stacks" ?)
>>>> Regards,
>>>> Parveen Jain
>>>>
>>>>
>>>>
>>>> On Fri, Aug 27, 2010 at 12:12 PM, Parveen Kumar Jain
>>>> <parveen.jain at one97.net> wrote:
>>>>>
>>>>> Hi Benny,
>>>>> ??Thanks for your quick reply.
>>>>> Following is the error traces which I just got after enabling traces in
>>>>> pjmedia stack.
>>>>> 17:03:53.283 transport_udp. ?Binding rtp port 4112 to socket 178
>>>>> 17:04:05.143 transport_udp. ?In udp Rtp key: rtp socket to be
>>>>> invalidated 178
>>>>> 17:04:05.143 ? ? ioq_select ?In pj_ioqueue_unregister: closing socket
>>>>> 178
>>>>> 17:04:05.453 transport_udp. ?Binding rtp port 4112 to socket 178
>>>>> 17:04:05.453 transport_udp. pj_sock_socket ERR3 120098
>>>>> As you can see from the last three lines that the same socket and ports
>>>>> are getting closed and the getting reopened within same second.I just have a
>>>>> feeling that might be that previous port was not yet closed but we trying to
>>>>> reopen it which might be giving this error.
>>>>>
>>>>> ??Your comments !
>>>>> Regards,
>>>>> Parveen Jain
>>>>>
>>>>> On Thu, Aug 26, 2010 at 8:48 AM, Benny Prijono <bennylp at teluu.com>
>>>>> wrote:
>>>>>>
>>>>>> On Wed, Aug 25, 2010 at 6:08 PM, Parveen Kumar Jain
>>>>>> <parveen.jain at one97.net> wrote:
>>>>>> > Hi All,
>>>>>> > ??I am trying to?evaluate?"pjmedia" project from quite some time for
>>>>>> > one of
>>>>>> > my IVR based solution.The Application?initiates?bulk sip calls and
>>>>>> > then
>>>>>> > starts the media using pjmedia stack.I am facing following issue
>>>>>> > while its
>>>>>> > usage in this way:
>>>>>> > ?- I was trying to use it one of my Bulk call scenario where I was
>>>>>> > trying to
>>>>>> > make 40 G729 calls(I am using intel IPP for achieving that).but
>>>>>> > pjmedia
>>>>>> > gives socket bind error after some uncertain time period(sometime I
>>>>>> > don't
>>>>>> > get this error even after 2 days of testing but sometime I get it
>>>>>> > after 2-3
>>>>>> > hours of testing).Just to add this, my local UDP port management is
>>>>>> > fine
>>>>>> > where I ask pjmedia to bind only those rtp/rtcp ports which are not
>>>>>> > already
>>>>>> > in use.
>>>>>>
>>>>>> The bind() error comes from the OS, so I'd say there's something wrong
>>>>>> with your port management.
>>>>>>
>>>>>> > ?Though I have found a very?interesting?fact while compiling the
>>>>>> > pjmedia. I
>>>>>> > found that "sock_bsd.c" is getting compiled on my linux system, as I
>>>>>> > was
>>>>>> > expecting it should have been ''sock_linux_kernel.c".can this be a
>>>>>> > cause of
>>>>>> > this "bind error" behavior ?
>>>>>>
>>>>>> The "bsd" stands for BSD socket API, not BSD OS, so it's the right
>>>>>> implementation to use. The "linux_kernel" stuff is for running PJLIB
>>>>>> inside Linux kernel, something that we used to support in the old
>>>>>> days.
>>>>>>
>>>>>> It's been long time since I tested bulk calling, I've forgotten what
>>>>>> the result was, so I'll let others comment on your questions below.
>>>>>>
>>>>>> ?-Benny
>>>>>>
>>>>>> > Besides, I have a few more questions regarding its usage for bulk
>>>>>> > calling:
>>>>>> > ?-?Is someone already tried to use it in this way or I mean if
>>>>>> > anybody tried
>>>>>> > to use it for making bulk calls ?
>>>>>> > ?- What are the maximum?simultaneous?calls it can support using
>>>>>> > G711U/G711A
>>>>>> > on a dual core Intel based Linux system(if someone has tried to do
>>>>>> > so) ?
>>>>>> > Also what would be its call rate if try to use it using G729 ?
>>>>>> >
>>>>>> >
>>>>>> > Regards,
>>>>>> > Parveen Jain
>>>>>> > _______________________________________________
>>>>>> > Visit our blog: http://blog.pjsip.org
>>>>>> >
>>>>>> > pjsip mailing list
>>>>>> > pjsip at lists.pjsip.org
>>>>>> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>> >
>>>>>> >
>>>>>>
>>>>>> _______________________________________________
>>>>>> Visit our blog: http://blog.pjsip.org
>>>>>>
>>>>>> pjsip mailing list
>>>>>> pjsip at lists.pjsip.org
>>>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Parveen Jain
>>>>> Technical Lead ? Network Engineering
>>>>> One97 Communications (P) Ltd
>>>>> B121, Sector 5, Noida, UP 201301
>>>>>
>>>>> P:? + 91 120 4770770? ? ? Extn:352
>>>>> M: + 91?? 9212708203
>>>>> W: www.one97world.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Parveen Jain
>>>> Technical Lead ? Network Engineering
>>>> One97 Communications (P) Ltd
>>>> B121, Sector 5, Noida, UP 201301
>>>>
>>>> P:? + 91 120 4770770? ? ? Extn:352
>>>> M: + 91?? 9212708203
>>>> W: www.one97world.com
>>>>
>>>>
>>>> _______________________________________________
>>>> Visit our blog: http://blog.pjsip.org
>>>>
>>>> pjsip mailing list
>>>> pjsip at lists.pjsip.org
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>
>>>
>>>
>>> _______________________________________________
>>> Visit our blog: http://blog.pjsip.org
>>>
>>> pjsip mailing list
>>> pjsip at lists.pjsip.org
>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>
>>
>>
>>
>> --
>> Parveen Jain
>> Technical Lead ? Network Engineering
>> One97 Communications (P) Ltd
>> B121, Sector 5, Noida, UP 201301
>>
>> P:? + 91 120 4770770? ? ? Extn:352
>> M: + 91?? 9212708203
>> W: www.one97world.com
>>
>
>
>
> --
> Parveen Jain
> Technical Lead ? Network Engineering
> One97 Communications (P) Ltd
> B121, Sector 5, Noida, UP 201301
>
> P:? + 91 120 4770770? ? ? Extn:352
> M: + 91?? 9212708203
> W: www.one97world.com
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux