Hypersonic

 view release on metacpan or  search on metacpan

lib/Hypersonic.pm  view on Meta::CPAN

    # so a cache built for one perl is never loaded into another).
    #
    # Pre-0.18 we used 'Hypersonic::_Server_' . int(rand(100000)) which
    # gave a different module name on every fresh perl process; because
    # XS::JIT's on-disk cache lives at
    #   <cache_dir>/lib/auto/<safe_name>/<safe_name>.<dlext>
    # (see XS-JIT/lib/XS/JIT/xs_jit.c xs_jit_cache_path()), a different
    # $name on every run forced a full gcc/cc re-invocation EVERY time
    # the test suite or a user re-ran their server. On slow CPAN smoker
    # boxes that gcc invocation takes 30-60+ seconds per server, which
    # is what caused the SIGKILL cascade in CPAN tester reports for
    # 0.17 (t/0035-e2e-streaming.t, t/2012..t/2017, t/2102).
    #
    # Using a content hash means: identical route+option configurations
    # produce the same module name -> warm cache hit -> dlopen() of a
    # 100ms .so instead of a 30s gcc rebuild. The random fallback id is
    # retained for the degenerate case where Digest::MD5 isn't available.
    my $module_id;
    {
        my $hash_input = join("\0",
            $c_code,

lib/Hypersonic/Event.pm  view on Meta::CPAN

# Pre-0.19 attempted to use io_uring's completion-based I/O
# (io_uring_prep_accept + io_uring_prep_recv) where the kernel did
# the I/O and returned the result via cqe->res, but that had two
# unfixable bugs:
#   (a) gen_get_fd discarded the accepted client_fd from cqe->res
#       for UD_ACCEPT and set fd=listen_fd, so the main loop's
#       accept(listen_fd) returned EAGAIN (kernel already had it)
#       and broke - leaking the connection.
#   (b) prep_recv used a single GLOBAL recv_buf shared across all
#       concurrent clients, corrupting each other's request data.
# This produced the "empty body + 18 SIGKILL cascade + 5140s
# wallclock" pattern in CPAN tester reports for Hypersonic 0.18 on
# cpansmoker-1023 (perl 5.38..5.43). The readiness-only design in
# 0.19 sidesteps both bugs.
#
# If a user's kernel doesn't behave as expected, the env var
# HYPERSONIC_EVENT_BACKEND=epoll (or any registered backend) and
# the constructor option `event_backend => 'epoll'` both override
# auto-detection.
my @PRIORITY = qw(io_uring epoll kqueue iocp event_ports poll select);



( run in 0.513 second using v1.01-cache-2.11-cpan-9581c071862 )