in reply to Re^3: yet another thread question: is Symbol::gensym threadsafe?
in thread yet another thread question: is Symbol::gensym threadsafe?

you are definitely right. this Session::... stuff is rather ancient code and has never been changed since, and the reason why it has always worked before might simply be that session objects don't become large. but planets and fleets data do, and i'm quite sure that's where the difficulties came from. i modified the respective parts as follows:
sub receive { my $self = shift; # Perl OO mantra + ... return undef unless ref $self; # .. continued unless (@_) { $self->{ERROR}->set(ILL_NUM); return 0; } my $sock = shift; local $/ = undef; unless (defined $sock->recv($self->{COMMAND}, $self->{COMMANDSIZE}) + && defined $sock->recv($self->{CONTENT_LENGTH}, $self->{CONTEN +TSIZE})) { $self->{ERROR}->set(SOCK_RECV); return 0; } my $cont = ''; $self->{CONTENT} = ''; while (length $self->{CONTENT} < $self->{CONTENT_LENGTH}) { unless (defined $sock->recv($cont, $self->{CONTENT_LENGTH})) { $self->{ERROR}->set(SOCK_RECV); return 0; } $self->{CONTENT} .= $cont; $cont = ''; } 1; }
and, although the loop doesn't seem to be necessary:
sub send { my $self = shift; return undef unless ref $self; my $sock = shift || $self{ERROR}->set(ILL_NUM); return 0 if $self->error->get; $self->{CONTENT_LENGTH} = length $self->{CONTENT}; my $str = sprintf("%$self->{CODESIZE}s", $self->{CODE}) . sprintf("%$self->{CONTENTSIZE}d", $self->{CONTENT_LENGTH} +) . $self->{CONTENT}; my $length = length $str; local $\ = undef; my ($sent, $tsend) = (0, 0); while ($sent < $length) { unless ($tsent = $sock->send($str)) { $self->error->set(SOCK_SEND, $!); return 0; } $sent += $tsent; $tsent = 0; } 1; }
i'm quite sure that this will fix the problem, and once again you nearly saved my life. :)
--------------------------------
masses are the opiate for religion.