Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dex4er/starlight

Starlight - a light and pure-Perl PSGI/Plack HTTP server with pre-forks
https://github.com/dex4er/starlight

Last synced: 10 days ago
JSON representation

Starlight - a light and pure-Perl PSGI/Plack HTTP server with pre-forks

Awesome Lists containing this project

README

        

NAME

starlight - Light and pure-Perl PSGI/Plack HTTP server with pre-forks

SYNOPSIS

$ starlight --max-workers=20 --max-reqs-per-child=100 app.psgi

$ starlight --port=80 --ipv6=1 app.psgi

$ starlight --port=443 --ssl=1 --ssl-key-file=file.key
--ssl-cert-file=file.crt app.psgi

$ starlight --socket=/tmp/starlight.sock app.psgi

DESCRIPTION

Starlight is a standalone HTTP/1.1 server with keep-alive support. It
uses pre-forking. It is a pure-Perl implementation that doesn't require
any XS package.

Starlight was started as a fork of Thrall server which is a fork of
Starlet server. It has almost the same code as Thrall and Starlet and
it was adapted to not use any other modules than Plack.

Starlight is created for Unix-like systems but it should also work on
Windows with some limitations.

SEE ALSO

Starlight, Thrall, Starlet, Starman

LIMITATIONS

Perl on Windows systems (MSWin32 and cygwin) emulates "fork" in
perlfunc and "waitpid" in perlfunc functions and uses threads
internally. See perlfork (MSWin32) and perlcygwin (cygwin) for details
and limitations.

It might be a better option to use on this system the server with
explicit threads implementation, i.e. Thrall.

For Cygwin the perl-libwin32 package is highly recommended, because of
Win32::Process module which helps to terminate stalled worker
processes.

BUGS

Windows

There is a problem with Perl threads implementation which occurs on
Windows systems (MSWin32). Cygwin version seems to be correct.

Some requests can fail with the message:

failed to set socket to nonblocking mode:An operation was attempted
on something that is not a socket.

or

Bad file descriptor at (eval 24) line 4.

This problem was introduced in Perl 5.16 and fixed in Perl 5.19.5.

See https://rt.perl.org/rt3/Public/Bug/Display.html?id=119003 and
https://github.com/dex4er/Thrall/issues/5 for more information about
this issue.

The server fails when a worker process calls "exit" in perlfunc
function:

Attempt to free unreferenced scalar: SV 0x293a76c, Perl interpreter:
0x22dcc0c at lib/Plack/Handler/Starlight.pm line 140.

It means that Harakiri mode can't work and the server has to be started
with --max-reqs-per-child=inf option.

See https://rt.perl.org/Public/Bug/Display.html?id=40565 and
https://github.com/dex4er/Starlight/issues/1 for more information about
this issue.

MacOS

MacOS High Sierra and newer shows error:

objc[12345]: +[__NSCFConstantString initialize] may have been in
progress in another thread when fork() was called. objc[12345]:
+[__NSCFConstantString initialize] may have been in progress in
another thread when fork() was called. We cannot safely call it or
ignore it in the fork() child process. Crashing instead. Set a
breakpoint on objc_initializeAfterForkError to debug.

This error is caused by an added security to restrict multithreading.

To override the limitation, run export
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES before using this server.

Reporting

If you find the bug or want to implement new features, please report it
at https://github.com/dex4er/Starlight/issues

The code repository is available at http://github.com/dex4er/Starlight

AUTHORS

Piotr Roszatycki

Based on Thrall by:

Piotr Roszatycki

Based on Starlet by:

Kazuho Oku

miyagawa

kazeburo

Some code based on Plack:

Tatsuhiko Miyagawa

Some code based on Net::Server::Daemonize:

Jeremy Howard

Paul Seamons

LICENSE

Copyright (c) 2013-2016, 2020, 2023 Piotr Roszatycki .

This is free software; you can redistribute it and/or modify it under
the same terms as perl itself.

See http://dev.perl.org/licenses/artistic.html