Comments (12)
I can't reproduce:
➜ ~ starman --backlog 600 --listen 0.0.0.0:8080 dev/Plack/eg/dot-psgi/Hello.psgi
2012/12/11-13:55:54 Starman::Server (type Net::Server::PreFork) starting! pid(25819)
Binding to TCP port 8080 on host 0.0.0.0 with IPv4
Setting gid to "20 20 20 401 12 33 61 79 80 81 98 100 204 402"
Check the versions of Plack, Starman and Net::Server and ugprade to the latest to see if the problem exists.
If it is fixed by upgrading versions, report it to me so that we can fix the dependency if there's any mistake.
from starman.
Thanks!
I made same tests and result exactly as your one
But if i run a project there i see error again (same machine and modules)
I noticed in code a following:
starman runs Plack::Runner and uses parse_options() for parsing of @argv
Plack::Runner::parse_options parses an options but parsed options are not deleted from hash and kept in $self->{argv}
Starman::Server::run kept options in @argv again before Net::Server::PreFork::run:
local @argv = (@{$options->{argv} || []});
And after runs the $self->SUPER::run (Net::Server::PreFork::run)
I think the 'listen' option is passed to Net::Server::PreFork again through @argv and affects there in some situations.
This option means a backlog queue of socket for Net::Server::* and means IP:PORT for Plack/starman
Same name but different values
I don't understand why i cannot reproduce with your example (application Plack/eg/dot-psgi/Hello.psgi) but i see errors there with same Plack/Starman/Net::Server modules for my project.
from starman.
I made:
vi /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm
Added code:
{
use Data::Dumper;
open FILE, '>', '/tmp/dump.txt';
print FILE Dumper( [ ARGV => \@ARGV, options => $options ] );
close FILE;
}
before $self->SUPER::run and got:
$ less /tmp/dump.txt
$VAR1 = [
'ARGV',
[
'--listen',
'MY_IP_ADDRESS:MY_PORT',
'--min_servers=12',
'--max_servers=48',
'--min_spare_servers=4',
'--max_spare_servers=20',
'--backlog',
'6000',
'--pid',
'/home/my_app/my_app/run/services/starman.pid',
'--error-log',
'/home/my_app/my_app/logs/starman/error.log',
'--access-log',
'/home/my_app/my_app/logs/starman/access.log',
'--daemonize',
'--app',
'/home/my_app/perl5/bin/my_app.psgi'
],
'options',
{
'backlog' => '6000',
'error_log' => '/home/my_app/my_app/logs/starman/error.log',
'keepalive_timeout' => 1,
'min_servers' => '12',
'port' => 'MY_PORT',
'host' => 'MY_IP_ADDRESS',
'socket' => undef,
'max_servers' => '48',
'listen' => [
'MY_IP_ADDRESS:MY_PORT'
],
'pid' => '/home/my_app/my_app/run/services/starman.pid',
'argv' => [
'--listen',
'MY_IP_ADDRESS:MY_PORT',
'--min_servers=12',
'--max_servers=48',
'--min_spare_servers=4',
'--max_spare_servers=20',
'--backlog',
'6000',
'--pid',
'/home/my_app/my_app/run/services/starman.pid',
'--error-log',
'/home/my_app/my_app/logs/starman/error.log',
'--access-log',
'/home/my_app/my_app/logs/starman/access.log',
'--daemonize',
'--app',
'/home/my_app/perl5/bin/my_app.psgi'
],
'keepalive' => 1,
'min_spare_servers' => '4',
'daemonize' => 1,
'max_spare_servers' => '20'
}
];
from starman.
So Net::Server in @argv has --listen as IP:PORT but he expects there length of queue (backlog)
So there is bug
from starman.
and how can you reproduce? Can you make a reproducible script that doesn't
depend on your application?
from starman.
Net::Server:
sub configure {
my $self = shift;
my $prop = $self->{'server'};
my $template = ($_[0] && ref($_[0])) ? shift : undef;
$self->process_args(\@ARGV, $template) if @ARGV; # command line
$self->process_args($prop->{'_run_args'}, $template) if $prop->{'_run_args'}; # passed to run
if ($prop->{'conf_file'}) {
$self->process_args($self->_read_conf($prop->{'conf_file'}), $template);
} else {
my $def = $self->default_values || {};
$self->process_args($self->_read_conf($def->{'conf_file'}), $template) if $def->{'conf_file'};
}
}
from starman.
and how can you reproduce? Can you make a reproducible script that doesn't depend on your application?
I will try it through 2-3 hours
from starman.
I am trying to reproduce with Plack/eg/dot-psgi/Hello.psgi but i cannot while
But anyway it's bad idea to pass --listen option through @argv when in Plack this means IP[:PORT] but in Net::Server it means backlog queue.
Comment from Net::Server:process_args:
we want subsequent calls to not overwrite or add to previously set values so that command line arguments win
I think better way to remove --listen from @argv before Net::Server::PreFork::run method execution
from starman.
But anyway it's bad idea to pass --listen option through @argv when in Plack this means IP[:PORT] but in Net::Server it means backlog queue.
Sure, that's why we clear stuff out of @ARGV
in Plack::Runner and when evaluating .psgi
script etc. but maybe we should do that more aggressively? I can't confirm until you come up with a standalone debug script, because it doesn't occur in my instance.
from starman.
Sure, that's why we clear stuff out of @ARGV in Plack::Runner and when evaluating .psgi script etc. but maybe we should do that more aggressively?
Yes, may be Plack cleans @argv but Starman restores @argv before Net::Server::run execution
I am seeing the code of Net::Server now because i want to understand how to reproduce problem with --listen
from starman.
Yes, may be Plack cleans @argv but Starman restores @argv before Net::Server::run execution
Right, but that @ARGV
is restored from $options->{argv}
which is already filtered out from Plack::Runner. plackup common options such as --listen
are meant to be filtered out.
...
Ok, now that I tried to confirm the behavior and found that $options->{argv}
is being recreated from the original script's ARGV, mainly to support HUP based restart which is not supported right now. See 6abaa02
I will remove this and argv will not propagated to Net::Server.
from starman.
Yes, i confirm that i don't have any warnings from IO::Socket now :)
I installed new version from master branch and now all is OK :)
Thanks!
from starman.
Related Issues (20)
- tests fail -- empty base class package HOT 1
- Starman in Production HOT 2
- Implement --max-keepalive-requests HOT 3
- POSIX::setgid not implemented on this architecture HOT 1
- starman hangs on make tests (Win 7, Strawberry perl) HOT 1
- Starman is missing ExtUtils::Config requirement HOT 1
- Support custom proctitles
- Dependency module name misspelling
- plackup: Use of uninitialized value $opt in lc at /home/vagrant/perl5/lib/perl5/Starman/Server.pm line 80.
- Feature request: Ability to run Starman in non-forking mode HOT 1
- How to use with systemd ExecReload and ExecStop? HOT 1
- start_server ignores https/ssl configuration of starman/plackup HOT 1
- allow client errors to be detected HOT 2
- Support for server-side trailer headers with chunk-encoded responses
- on some hosts requests are too slow - any ideas ? HOT 1
- *
- Please add config option to `chmod` a UNIX socket
- --listen and --host options do not support IPv6 addresses HOT 4
- Add worker timeout option HOT 3
- Starman worker zombie processes showing up HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starman.