Skip Menu |

This queue is for tickets about the Net-Server CPAN distribution.

Report information
The Basics
Id: 3168
Status: resolved
Priority: 0/
Queue: Net-Server

People
Owner: Nobody in particular
Requestors: simonhf [...] web.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.85
Fixed in: (no value)

Attachments


Subject: bug with port declaration in config file
When specifying 'port = 20204' in the config file and requesting a 'Net::Server::PreForkSimple' then a 'Address already in use' error is generated. After adding some debug statements to 'Server.pm' then the following appears in the log file: process_args(): log_level = 4 process_args(): pid_file = mywebserver.pid process_args(): port = 20204 (array) Becoming sub class of "Net::Server::PreForkSimple" process_args() calling process_conf() calling process_args() process_args() process_args(): max_servers = 5 process_args(): max_requests = 1000 process_args(): log_level = 4 process_args(): pid_file = mywebserver.pid process_args(): port = 20204 (array) pre_bind() 2003/08/06-05:34:17 RPC::XML::Server (type Net::Server::MultiType) starting! pid(4891) pre_bind(): port: 20204 pre_bind(): port: 20204 Binding to TCP port 20204 on host * Binding to TCP port 20204 on host * 2003/08/06-05:34:17 Can't connect to TCP port 20204 on * [Address already in use] at line 86 in file /usr/lib/perl5/site_perl/5.8.0/Net/Server/Proto/TCP.pm 2003/08/06-05:34:17 Server closing! It appears that the configuration file is digested twice (why?) and this results in two protocol objects using the same port... and the error. How to fix this cleanly?
Date: Thu, 7 Aug 2003 12:25:32 -0600 (MDT)
From: Rob Brown <rob [...] roobik.com>
To: Guest via RT <bug-Net-Server [...] rt.cpan.org>
Subject: Re: [cpan #3168] bug with port declaration in config file
RT-Send-Cc:
I have not been able to duplicate this error. Can I have more details? Your module code? What commandline args? Your config file? I can't fix the bug if I can't see the bug myself. -- Rob On Wed, 6 Aug 2003, Guest via RT wrote: Show quoted text
> > This message about Net-Server was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=3168 > > > When specifying 'port = 20204' in the config file and requesting a 'Net::Server::PreForkSimple' then a 'Address already in use' error is generated. > > After adding some debug statements to 'Server.pm' then the following appears in the log file: > > process_args(): log_level = 4 > process_args(): pid_file = mywebserver.pid > process_args(): port = 20204 (array) > Becoming sub class of "Net::Server::PreForkSimple" > process_args() > calling process_conf() > calling process_args() > process_args() > process_args(): max_servers = 5 > process_args(): max_requests = 1000 > process_args(): log_level = 4 > process_args(): pid_file = mywebserver.pid > process_args(): port = 20204 (array) > pre_bind() > 2003/08/06-05:34:17 RPC::XML::Server (type Net::Server::MultiType) starting! pid(4891) > pre_bind(): port: 20204 > pre_bind(): port: 20204 > Binding to TCP port 20204 on host * > Binding to TCP port 20204 on host * > 2003/08/06-05:34:17 Can't connect to TCP port 20204 on * [Address already in use] > at line 86 in file /usr/lib/perl5/site_perl/5.8.0/Net/Server/Proto/TCP.pm > 2003/08/06-05:34:17 Server closing! > > It appears that the configuration file is digested twice (why?) and this results in two protocol objects using the same port... and the error. > > How to fix this cleanly? >
Rob, please find attached a zip file containing a short pl script and associated conf file. Together they illustrate the problem. The output of the script looks like this: [net_server_bug]$ perl net_server_bug.pl creating server object Becoming sub class of "Net::Server::PreForkSimple" 2003/08/08-10:07:02 RPC::XML::Server (type Net::Server::MultiType) starting! pid(20147) Binding to TCP port 12345 on host * Binding to TCP port 12345 on host * 2003/08/08-10:07:02 Can't connect to TCP port 12345 on * [Address already in use] at line 86 in file /usr/lib/perl5/site_perl/5.8.0/Net/Server/Proto/TCP.pm 2003/08/08-10:07:02 Server closing! As you'll see then it's the RPC::XML module that actually creates Net::Server in MultiType mode. In turn the conf file specifies PreForkSimple mode. What seems to happen is that Net::Server reads the conf file twice; once as it is initialized in MultiType mode and once again for PreForkSimple mode. This causes the port to be read twice and stored twice in an internal array of Net::Server. Thus it tries to bind to the port twice, and the error. I work around this problem by removing the port declaration from the conf file and putting it in the pl script next to the conf parameter. Hope this helps, Simon [rob@roobik.com - Thu Aug 7 14:25:37 2003]: Show quoted text
> I have not been able to duplicate this error. > Can I have more details? Your module code? > What commandline args? Your config file? > I can't fix the bug if I can't see the bug myself. > > -- > Rob
Download net_server_bug.zip
application/x-zip-compressed 869b

Message body not shown because it is not plain text.