Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: pavel [...] gingerall.cx
Cc:
AdminCc:

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



Subject: Net::Server comments/questions
Paul, it's more commants/question the a real bugs, but e-mails sent to your address are bounced. We've started to use your Net::Server module. First many thanks, it saves a lot of work. Here are my comments and questions. 1) Why the number of log levels doesn't match the number available for syslog? 2) We use UNIX sockets in pre-forked server. After a while I've discovered that the name socket is bound to must be given in a port name as an array ref. (like server => {port => ["my-filename"]}) Documentation is unclear on this. 3) If I looked into Proto/UNIX.pm it tries to read "unix_path" and "unix_type" from server props, but these settings are immediately rewritten by values given in port - as a result of this "unix*" props plays never any role as the port is always set (at least it defaults to 20203). So what's the role of "unix*" params (not documented). 4) Net::Server::UNIX doesn't remove the socket file when exitng. I didn't read all the code and it is quite possible I've overlooked something important. I'm sorry to bother you in such case. If you give me some feedback and guidelines, I'm ready to help you with coding. Have a nice day Pavel
[PAVELH - Fri Oct 17 08:21:20 2003]: Damned... my email ends with .cz, please be so nice and put me to a cc list.
Date: Fri, 24 Oct 2003 14:14:57 -0600 (MDT)
From: Rob Brown <bbb [...] cpan.org>
To: via RT <bug-Net-Server [...] rt.cpan.org>
CC: PAVELH [...] cpan.org, <bbb [...] cpan.org>
Subject: Re: [cpan #4141] Net::Server comments/questions
RT-Send-Cc:
Mr Pavel: 1) Not sure about the syslog levels. 2) I think the docs needs to be clarified. It can take an array ref in order to support multiple ports. I'm not sure how this works with UNIX sockets. 3) Not sure about the unix_* props either. I'll review that. 4) Good idea to remove the socket file. I'll work on that for the next release. -- Rob On Fri, 17 Oct 2003, you wrote: Show quoted text
> This message about Net-Server was sent to you by PAVELH <PAVELH@cpan.org> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=4141 > > > Paul, > > it's more commants/question the a real bugs, but e-mails sent to your address are bounced. > > We've started to use your Net::Server module. First many thanks, it saves a lot of work. Here are my comments and questions. > > 1) Why the number of log levels doesn't match the number available for syslog? > > 2) We use UNIX sockets in pre-forked server. After a while I've discovered that the name socket is bound to must be given in a port name as an array ref. (like server => {port => ["my-filename"]}) Documentation is unclear on this. > > 3) If I looked into Proto/UNIX.pm it tries to read "unix_path" and "unix_type" from server props, but these settings are immediately rewritten by values given in port - as a result of this "unix*" props plays never any role as the port is always set (at least it defaults to 20203). So what's the role of "unix*" params (not documented). > > 4) Net::Server::UNIX doesn't remove the socket file when exitng. > > I didn't read all the code and it is quite possible I've overlooked something important. I'm sorry to bother you in such case. If you give me some feedback and guidelines, I'm ready to help you with coding. > > Have a nice day > > Pavel
Date: Wed, 29 Oct 2003 14:21:11 +0100
From: Pavel Hlavnicka <pavel [...] gingerall.cz>
To: Rob Brown <bbb [...] cpan.org>
CC: via RT <bug-Net-Server [...] rt.cpan.org>, PAVELH [...] cpan.org
Subject: Re: [cpan #4141] Net::Server comments/questions
RT-Send-Cc:
Rob, thanks for your reply. Until now I could fit into existing boundaries. I've found some limitations using the PreFork.pm server. What I need is to establish a control connection to the parent process (either of socket or just stdio), and I need to handle input on this channel in run_parent method. Currently there is no way to hook in. In run_parent the child_is_talking_hook hook is called, but it can not happen, as it is not possible to add some handle into child_select. I think that it would be fine (and quite logic) to introduce new hooks for PreFork server like pre_fork_hook, post_fork_hook (per child process) pre_run_parent_hook, post_run_parent_hook (for controlling process) The patch is attached for for the second case. Thanks for your great work. Pavel Rob Brown wrote: Show quoted text
> Mr Pavel: > > 1) Not sure about the syslog levels. > > 2) I think the docs needs to be clarified. It can take > an array ref in order to support multiple ports. I'm > not sure how this works with UNIX sockets. > > 3) Not sure about the unix_* props either. I'll review that. > > 4) Good idea to remove the socket file. I'll work on that > for the next release. > > -- Rob > > On Fri, 17 Oct 2003, you wrote: >
>>This message about Net-Server was sent to you by PAVELH <PAVELH@cpan.org> via rt.cpan.org >> >>Full context and any attached attachments can be found at: >><URL: https://rt.cpan.org/Ticket/Display.html?id=4141 > >> >>Paul, >> >>it's more commants/question the a real bugs, but e-mails sent to your address are bounced. >> >>We've started to use your Net::Server module. First many thanks, it saves a lot of work. Here are my comments and questions. >> >>1) Why the number of log levels doesn't match the number available for syslog? >> >>2) We use UNIX sockets in pre-forked server. After a while I've discovered that the name socket is bound to must be given in a port name as an array ref. (like server => {port => ["my-filename"]}) Documentation is unclear on this. >> >>3) If I looked into Proto/UNIX.pm it tries to read "unix_path" and "unix_type" from server props, but these settings are immediately rewritten by values given in port - as a result of this "unix*" props plays never any role as the port is always set (at least it defaults to 20203). So what's the role of "unix*" params (not documented). >> >>4) Net::Server::UNIX doesn't remove the socket file when exitng. >> >>I didn't read all the code and it is quite possible I've overlooked something important. I'm sorry to bother you in such case. If you give me some feedback and guidelines, I'm ready to help you with coding. >> >>Have a nice day >> >>Pavel
-- Pavel Hlavnicka Ginger Alliance www.gingerall.com
*** PreFork.pm.orig 2003-10-29 14:12:45.000000000 +0100 --- PreFork.pm 2003-10-29 14:19:09.000000000 +0100 *************** *** 129,138 **** --- 129,143 ---- $self->run_n_children( $prop->{min_servers} ); ### finish the parent routines + $self->pre_run_parent_hook; $self->run_parent; + $self->post_run_parent_hook; } + sub pre_run_parent_hook {} + sub post_run_parent_hook {} + ### sub to kill of a specified number of children sub kill_n_children { my $self = shift; *************** *** 652,657 **** --- 657,672 ---- has written to $self->{server}->{parent_sock}. The first argument will be the open socket to the child. + =item C<$self-E<gt>pre_run_parent_hook()> + + This hook occurs immediately before the controlling (parent) process + enters the endless loop. No arguments are available. + + =item C<$self-E<gt>post_run_parent_hook()> + + This hook occurs immediately after the controlling (parent) process + leaves the endless loop. No arguments are available. + =back =head1 TO DO
Date: Wed, 29 Oct 2003 15:48:30 +0100
From: Pavel Hlavnicka <pavel [...] gingerall.cz>
To: Rob Brown <bbb [...] cpan.org>
CC: via RT <bug-Net-Server [...] rt.cpan.org>, PAVELH [...] cpan.org
Subject: Re: [cpan #4141] Net::Server comments/questions
RT-Send-Cc:
Rob, it's me again :) attached is a cumulative patch for PreFork.pm. I introduced two more hooks called (pre_post)_parent_comm_hook. They are executed run_parent method; pre_* immediately some waited handle is signaled or can_read is timed out. In addition these callbacks may be used to break the main parent loop. I'm doing this to get a control over the main process in a better way then signal sending. I hope you'll find this useful and integrate it with your code. Thanks Pavel Rob Brown wrote: Show quoted text
> Mr Pavel: > > 1) Not sure about the syslog levels. > > 2) I think the docs needs to be clarified. It can take > an array ref in order to support multiple ports. I'm > not sure how this works with UNIX sockets. > > 3) Not sure about the unix_* props either. I'll review that. > > 4) Good idea to remove the socket file. I'll work on that > for the next release. > > -- Rob > > On Fri, 17 Oct 2003, you wrote: >
>>This message about Net-Server was sent to you by PAVELH <PAVELH@cpan.org> via rt.cpan.org >> >>Full context and any attached attachments can be found at: >><URL: https://rt.cpan.org/Ticket/Display.html?id=4141 > >> >>Paul, >> >>it's more commants/question the a real bugs, but e-mails sent to your address are bounced. >> >>We've started to use your Net::Server module. First many thanks, it saves a lot of work. Here are my comments and questions. >> >>1) Why the number of log levels doesn't match the number available for syslog? >> >>2) We use UNIX sockets in pre-forked server. After a while I've discovered that the name socket is bound to must be given in a port name as an array ref. (like server => {port => ["my-filename"]}) Documentation is unclear on this. >> >>3) If I looked into Proto/UNIX.pm it tries to read "unix_path" and "unix_type" from server props, but these settings are immediately rewritten by values given in port - as a result of this "unix*" props plays never any role as the port is always set (at least it defaults to 20203). So what's the role of "unix*" params (not documented). >> >>4) Net::Server::UNIX doesn't remove the socket file when exitng. >> >>I didn't read all the code and it is quite possible I've overlooked something important. I'm sorry to bother you in such case. If you give me some feedback and guidelines, I'm ready to help you with coding. >> >>Have a nice day >> >>Pavel
-- Pavel Hlavnicka Ginger Alliance www.gingerall.com
*** PreFork.pm.orig 2003-10-29 14:12:45.000000000 +0100 --- PreFork.pm 2003-10-29 15:35:32.000000000 +0100 *************** *** 129,138 **** --- 129,143 ---- $self->run_n_children( $prop->{min_servers} ); ### finish the parent routines + $self->pre_run_parent_hook; $self->run_parent; + $self->post_run_parent_hook; } + sub pre_run_parent_hook {} + sub post_run_parent_hook {} + ### sub to kill of a specified number of children sub kill_n_children { my $self = shift; *************** *** 317,322 **** --- 322,330 ---- ## getline or <$fh> but this is controlled output ## where everything that comes through came from us. my @fh = $prop->{child_select}->can_read($prop->{check_for_waiting}); + + last if $self -> pre_parent_comm_hook(@fh); + if( &check_sigs() ){ last if $prop->{_HUP}; } *************** *** 364,375 **** --- 372,389 ---- ### check up on the children $self->coordinate_children(); + + ### run one more hook + last if $self -> post_parent_comm_hook(@fh); } ### allow fall back to main run method } + sub pre_parent_comm_hook {} + sub post_parent_comm_hook {} + ### routine to determine if more children need to be started or stopped sub coordinate_children { *************** *** 648,656 **** =item C<$self-E<gt>child_is_talking_hook()> ! This hook occurs if child_communication is true and the child ! has written to $self->{server}->{parent_sock}. The first argument ! will be the open socket to the child. =back --- 662,696 ---- =item C<$self-E<gt>child_is_talking_hook()> ! This hook occurs if child_communication is true and the child has ! written to $self->{server}->{parent_sock}. The first argument will be ! the open socket to the child. ! ! =item C<$self-E<gt>pre_run_parent_hook()> ! ! This hook occurs immediately before the controlling (parent) process ! enters the endless loop. No arguments are available. ! ! =item C<$self-E<gt>post_run_parent_hook()> ! ! This hook occurs immediately after the controlling (parent) process ! leaves the endless loop. No arguments are available. ! ! =item C<$self-E<gt>pre_parent_comm_hook()> ! ! This hook is called if the parent process executes the main control ! loop body. It may happen if some child handle is signaled or if ! C<can_read> is timed out. A list of signaled handles is passed in. if ! this hook return non-zero value, the parent main control loop is ! terminated. ! ! =item C<$self-E<gt>post_parent_comm_hook()> ! ! This hook is called after the parent process executes the main control ! loop body. It may happen if some child handle is signaled or if ! C<can_read> is timed out. A list of signaled handles is passed in. if ! this hook return non-zero value, the parent main control loop is ! terminated. =back
Date: Thu, 30 Oct 2003 16:41:35 +0100
From: Pavel Hlavnicka <pavel [...] gingerall.cz>
To: Rob Brown <bbb [...] cpan.org>
CC: via RT <bug-Net-Server [...] rt.cpan.org>, PAVELH [...] cpan.org
Subject: Re: [cpan #4141] Net::Server comments/questions
RT-Send-Cc:
Sorry for keeping to bother you :) Just small improvement, post_parent_comm_hook is called always now. Drop all recent patches. Pavel Rob Brown wrote: Show quoted text
> Mr Pavel: > > 1) Not sure about the syslog levels. > > 2) I think the docs needs to be clarified. It can take > an array ref in order to support multiple ports. I'm > not sure how this works with UNIX sockets. > > 3) Not sure about the unix_* props either. I'll review that. > > 4) Good idea to remove the socket file. I'll work on that > for the next release. > > -- Rob > > On Fri, 17 Oct 2003, you wrote: >
>>This message about Net-Server was sent to you by PAVELH <PAVELH@cpan.org> via rt.cpan.org >> >>Full context and any attached attachments can be found at: >><URL: https://rt.cpan.org/Ticket/Display.html?id=4141 > >> >>Paul, >> >>it's more commants/question the a real bugs, but e-mails sent to your address are bounced. >> >>We've started to use your Net::Server module. First many thanks, it saves a lot of work. Here are my comments and questions. >> >>1) Why the number of log levels doesn't match the number available for syslog? >> >>2) We use UNIX sockets in pre-forked server. After a while I've discovered that the name socket is bound to must be given in a port name as an array ref. (like server => {port => ["my-filename"]}) Documentation is unclear on this. >> >>3) If I looked into Proto/UNIX.pm it tries to read "unix_path" and "unix_type" from server props, but these settings are immediately rewritten by values given in port - as a result of this "unix*" props plays never any role as the port is always set (at least it defaults to 20203). So what's the role of "unix*" params (not documented). >> >>4) Net::Server::UNIX doesn't remove the socket file when exitng. >> >>I didn't read all the code and it is quite possible I've overlooked something important. I'm sorry to bother you in such case. If you give me some feedback and guidelines, I'm ready to help you with coding. >> >>Have a nice day >> >>Pavel
-- Pavel Hlavnicka Ginger Alliance www.gingerall.com
*** PreFork.pm.orig 2003-10-29 14:12:45.000000000 +0100 --- PreFork.pm 2003-10-30 13:28:02.000000000 +0100 *************** *** 129,138 **** --- 129,143 ---- $self->run_n_children( $prop->{min_servers} ); ### finish the parent routines + $self->pre_run_parent_hook; $self->run_parent; + $self->post_run_parent_hook; } + sub pre_run_parent_hook {} + sub post_run_parent_hook {} + ### sub to kill of a specified number of children sub kill_n_children { my $self = shift; *************** *** 310,322 **** ); ### loop on reading info from the children while( 1 ){ ### Wait to read. ## Normally it is not good to do selects with ## getline or <$fh> but this is controlled output ## where everything that comes through came from us. ! my @fh = $prop->{child_select}->can_read($prop->{check_for_waiting}); if( &check_sigs() ){ last if $prop->{_HUP}; } --- 315,331 ---- ); ### loop on reading info from the children + my @fh; while( 1 ){ ### Wait to read. ## Normally it is not good to do selects with ## getline or <$fh> but this is controlled output ## where everything that comes through came from us. ! @fh = $prop->{child_select}->can_read($prop->{check_for_waiting}); ! ! last if $self -> pre_parent_comm_hook(@fh); ! if( &check_sigs() ){ last if $prop->{_HUP}; } *************** *** 364,375 **** ### check up on the children $self->coordinate_children(); ! } ### allow fall back to main run method } ### routine to determine if more children need to be started or stopped sub coordinate_children { --- 373,390 ---- ### check up on the children $self->coordinate_children(); ! ! } continue { ! ### run one more hook ! last if $self -> post_parent_comm_hook(@fh); } ### allow fall back to main run method } + sub pre_parent_comm_hook {} + sub post_parent_comm_hook {} + ### routine to determine if more children need to be started or stopped sub coordinate_children { *************** *** 648,656 **** =item C<$self-E<gt>child_is_talking_hook()> ! This hook occurs if child_communication is true and the child ! has written to $self->{server}->{parent_sock}. The first argument ! will be the open socket to the child. =back --- 663,697 ---- =item C<$self-E<gt>child_is_talking_hook()> ! This hook occurs if child_communication is true and the child has ! written to $self->{server}->{parent_sock}. The first argument will be ! the open socket to the child. ! ! =item C<$self-E<gt>pre_run_parent_hook()> ! ! This hook occurs immediately before the controlling (parent) process ! enters the endless loop. No arguments are available. ! ! =item C<$self-E<gt>post_run_parent_hook()> ! ! This hook occurs immediately after the controlling (parent) process ! leaves the endless loop. No arguments are available. ! ! =item C<$self-E<gt>pre_parent_comm_hook()> ! ! This hook is called if the parent process executes the main control ! loop body. It may happen if some child handle is signaled or if ! C<can_read> is timed out. A list of signaled handles is passed in. if ! this hook return non-zero value, the parent main control loop is ! terminated. ! ! =item C<$self-E<gt>post_parent_comm_hook()> ! ! This hook is called after the parent process executes the main control ! loop body. It may happen if some child handle is signaled or if ! C<can_read> is timed out. A list of signaled handles is passed in. if ! this hook return non-zero value, the parent main control loop is ! terminated. =back