ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.256 by root, Sat Apr 21 16:56:32 2007 UTC vs.
Revision 1.262 by root, Sat Apr 28 05:55:55 2007 UTC

1535 Coro::cede; 1535 Coro::cede;
1536 $self->activate; 1536 $self->activate;
1537 } 1537 }
1538 1538
1539 $self->in_memory (cf::MAP_IN_MEMORY); 1539 $self->in_memory (cf::MAP_IN_MEMORY);
1540
1541 undef $guard;
1542 } 1540 }
1543 1541
1544 $self->post_load; 1542 $self->post_load;
1545} 1543}
1546 1544
2437 2435
2438 die $$res unless "ARRAY" eq ref $res; 2436 die $$res unless "ARRAY" eq ref $res;
2439 2437
2440 return wantarray ? @$res : $res->[-1]; 2438 return wantarray ? @$res : $res->[-1];
2441 } else { 2439 } else {
2440 reset_signals;
2442 local $SIG{__WARN__}; 2441 local $SIG{__WARN__};
2442 local $SIG{__DIE__};
2443 eval { 2443 eval {
2444 local $SIG{__DIE__};
2445 close $fh1; 2444 close $fh1;
2446 2445
2447 my @res = eval { $cb->(@args) }; 2446 my @res = eval { $cb->(@args) };
2448 syswrite $fh2, Coro::Storable::freeze +($@ ? \"$@" : \@res); 2447 syswrite $fh2, Coro::Storable::freeze +($@ ? \"$@" : \@res);
2449 }; 2448 };
2925 prio => 6, 2924 prio => 6,
2926 cb => \&IO::AIO::poll_cb, 2925 cb => \&IO::AIO::poll_cb,
2927 ); 2926 );
2928} 2927}
2929 2928
2929my $_log_backtrace;
2930
2931sub _log_backtrace {
2932 my ($msg, @addr) = @_;
2933
2934 $msg =~ s/\n//;
2935
2936 # limit the # of concurrent backtraces
2937 if ($_log_backtrace < 2) {
2938 ++$_log_backtrace;
2939 async {
2940 my @bt = fork_call {
2941 @addr = map { sprintf "%x", $_ } @addr;
2942 my $self = (-f "/proc/$$/exe") ? "/proc/$$/exe" : $^X;
2943 open my $fh, "exec addr2line -C -f -i -e \Q$self\E @addr 2>&1 |"
2944 or die "addr2line: $!";
2945
2946 my @funcs;
2947 my @res = <$fh>;
2948 chomp for @res;
2949 while (@res) {
2950 my ($func, $line) = splice @res, 0, 2, ();
2951 push @funcs, "[$func] $line";
2952 }
2953
2954 @funcs
2955 };
2956
2957 LOG llevInfo, "[ABT] $msg\n";
2958 LOG llevInfo, "[ABT] $_\n" for @bt;
2959 --$_log_backtrace;
2960 };
2961 } else {
2962 LOG llevInfo, "[ABT] $msg\n";
2963 LOG llevInfo, "[ABT] [suppressed]\n";
2964 }
2965}
2966
2930# load additional modules 2967# load additional modules
2931use cf::pod; 2968use cf::pod;
2932 2969
2933END { cf::emergency_save } 2970END { cf::emergency_save }
2934 2971

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines