[OpenSER-Users] perl + unixODBC

Murilo Lacerda Yoshida murilo.yoshida at voxage.com.br
Mon Sep 24 20:59:44 CEST 2007

  Hi Henning,
  I found some documentation regarding perl and DBI - DBD::ODBC in multi
threaded environments:

- http://www.annocpan.org/~TIMB/DBI-1.59/DBI.pm - Threads and Thread
Safety section
- http://www.perlmonks.org/?node_id=631513
- http://www.perlmonks.org/index.pl?node_id=288022

  These docs warn about the use of DBI (and other perl modules) with
Perl in multi threaded environments using iThread, which as I understood
is the Perl way of doing threads.

  So first of all a question: does the Perl module uses iThreads?
  I looked a little bit at the perl module code, and I saw that in the
perl.d (and perlfunc.d) file it includes the
/usr/lib/perl/5.8/CORE/thread.h header, which seems to define some perl
functions to use perl threads (iThread).

  If the perl module really uses iThreads, then what I have to do is
clear, right? I have to take another path to communicate with my DB, as
the perl module isn't reliable when it uses DBI in multi threaded

  Another path would be to make openser work in only one thread, but
that will affect the performance of my server.

  Another question is: If the perl module really uses iThreads, then is
there another perl extension (like DBI) in which the same problem



-----Original Message-----
From: users-bounces at openser.org [mailto:users-bounces at openser.org] On
Behalf Of Murilo Lacerda Yoshida
Sent: segunda-feira, 24 de setembro de 2007 12:31
To: users at openser.org
Subject: RE: [OpenSER-Users] perl + unixODBC

  Hi Henning,
  This is the coredump for the crash described:

#0  0xb7dcd7c6 in raise () from /lib/libc.so.6
#1  0xb7dcf0e1 in abort () from /lib/libc.so.6
#2  0xb7e04edb in __fsetlocking () from /lib/libc.so.6
#3  0xb7e0ce15 in malloc_set_state () from /lib/libc.so.6
#4  0xb7e108e0 in free () from /lib/libc.so.6
#5  0xb7c4ce71 in Perl_safesysfree () from /usr/lib/libperl.so.5.8
#6  0xb5931f2e in odbc_st_destroy () from
#7  0xb59271fa in XS_DBD__ODBC__st_DESTROY () from
#8  0xb5a30ac4 in XS_DBI_dispatch () from /usr/lib/perl5/auto/DBI/DBI.so
#9  0xb7c5c81b in Perl_pp_entersub () from /usr/lib/libperl.so.5.8
#10 0xb7bfcb91 in Perl_magicname () from /usr/lib/libperl.so.5.8
#11 0xb7bfd844 in Perl_call_sv () from /usr/lib/libperl.so.5.8
#12 0xb7c69627 in Perl_sv_clear () from /usr/lib/libperl.so.5.8
#13 0xb7c69e93 in Perl_sv_free () from /usr/lib/libperl.so.5.8
#14 0xb7c69951 in Perl_sv_clear () from /usr/lib/libperl.so.5.8
#15 0xb7c69e93 in Perl_sv_free () from /usr/lib/libperl.so.5.8
#16 0xb7c4e5bc in Perl_mg_free () from /usr/lib/libperl.so.5.8
#17 0xb7c69834 in Perl_sv_clear () from /usr/lib/libperl.so.5.8
#18 0xb7c69e93 in Perl_sv_free () from /usr/lib/libperl.so.5.8
#19 0xb7c69faf in Perl_sv_unref_flags () from /usr/lib/libperl.so.5.8
#20 0xb7c68ce6 in Perl_sv_force_normal_flags () from
#21 0xb7c8b336 in Perl_leave_scope () from /usr/lib/libperl.so.5.8
#22 0xb7c8b413 in Perl_pop_scope () from /usr/lib/libperl.so.5.8
#23 0xb7c951eb in Perl_pp_return () from /usr/lib/libperl.so.5.8
#24 0xb7c5af19 in Perl_runops_standard () from /usr/lib/libperl.so.5.8
#25 0xb7bfcb6e in Perl_magicname () from /usr/lib/libperl.so.5.8
#26 0xb7bfd844 in Perl_call_sv () from /usr/lib/libperl.so.5.8
#27 0xb7bfe445 in Perl_call_pv () from /usr/lib/libperl.so.5.8
#28 0xb7d0a2df in perl_exec2 (_msg=0xb7d8b020, fnc=0x817e490 "CSP",
mystr=0x0) at perlfunc.c:150
#29 0xb7d0a56c in perl_exec1 (_msg=0xb7d8b020, fnc=0x817e490 "CSP",
foobar=0x0) at perlfunc.c:90
#30 0x08053116 in do_action (a=0x817e518, msg=0xb7d8b020) at
#31 0x080553ea in run_action_list (a=0x817e518, msg=0xb7d8b020) at
#32 0x08091582 in eval_expr (e=0x817e570, msg=0xb7d8b020,
val=0xbfb76b88) at route.c:1058
#33 0x08054d60 in do_assign (msg=0xb7d8b020, a=0x817e598) at
#34 0x080527cb in do_action (a=0x817e598, msg=0xb7d8b020) at
#35 0x080553ea in run_action_list (a=0x817e028, msg=0xb7d8b020) at
#36 0x080543dd in do_action (a=0x81819a0, msg=0xb7d8b020) at
#37 0x080553ea in run_action_list (a=0x817d250, msg=0xb7d8b020) at
#38 0x08053a3b in do_action (a=0x81830e8, msg=0xb7d8b020) at
#39 0x080553ea in run_action_list (a=0x8182e48, msg=0xb7d8b020) at
#40 0x08055669 in run_top_route (a=0x8182e48, msg=0xb7d8b020) at
#41 0xb7d79bb6 in t_should_relay_response (Trans=0xb5c87e18,
new_code=Variable "new_code" is not available.
) at t_reply.c:601
#42 0xb7d79e4d in relay_reply (t=0xb5c87e18, p_msg=0x8188a78, branch=0,
msg_status=503, cancel_bitmap=0xbfb773a0) at t_reply.c:1035
#43 0xb7d7c30b in reply_received (p_msg=0x8188a78) at t_reply.c:1383
#44 0x080614bb in forward_reply (msg=0x8188a78) at forward.c:489
#45 0x08084124 in receive_msg (
    buf=0x8140860 "SIP/2.0 503 Service Unavailable\r\nVia: SIP/2.0/UDP;branch=z9hG4bK048c.9bab482.0\r\nVia: SIP/2.0/UDP
19---Type <return> to continue, or q <return> to quit---\r\nTo: <sip:1919%23007755115678 at>\r\nFrom:
<sip:115083400"..., len=334, rcv_info=Variable "rcv_info" is not
) at receive.c:195
#46 0x080b534a in udp_rcv_loop () at udp_server.c:465
#47 0x0807011b in main_loop () at main.c:834
#48 0x08071e65 in main (argc=3, argv=0xbfb77684) at main.c:1399

  Apparently the problem is somewhere in Perl?



-----Original Message-----
From: Henning Westerholt [mailto:henning.westerholt at 1und1.de] 
Sent: segunda-feira, 24 de setembro de 2007 05:23
To: users at openser.org
Cc: Murilo Lacerda Yoshida
Subject: Re: [OpenSER-Users] perl + unixODBC

On Friday 21 September 2007, Murilo Lacerda Yoshida wrote:
>  Hello all,
>  I'm new in the list, so first of all I would like to say hi to all
> list and say that openSer is a fantastic product, and that the
> documentation available on the internet is also fantastic. 
> [..]

Hello Murilo,

nice to hear that. :-)

>  The other and main reason is that for some unknown reason the openSer
> server crashes when using perl scripts that communicate with DB in
> load contexts. For some reason the perl script receives a sig_segv
> (segmentation fault) and this signal is passed to all others threads
> then the openSer server dies.
>  This error is that kind of error that is specially difficult to find,
> because there are too many different systems involded. The path from
> openSer to the DB would be:
>  openSer -> perl module -> perl -> perl DBI (DBD::ODBC) -> unixODBC ->
> FreeTDS -> MS SQLServer

Yes, there are quite a bit modules involved.

Take a look into the core dump (set core_dump = yes) with gdb, this
give you further informations about the cause of the segmention fault.
To get 
a better backtrace install the debug package (debian) or compile with 
debugging enabled. If the error is located in openser, please post the 
backtrace also on the list.



Users mailing list
Users at openser.org

More information about the Users mailing list