Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New release #8113

Merged
merged 17 commits into from
Feb 10, 2025
Merged

New release #8113

merged 17 commits into from
Feb 10, 2025

Conversation

waghanza
Copy link
Collaborator

@waghanza waghanza commented Jan 3, 2025

Hi,

This PR will update release.

I have however an issue with axum, with version 0.8

root@699c7e31e802:/# /usr/src/app/target/release/server
thread 'main' panicked at src/main.rs:10:10:
Path segments must not start with `:`. For capture groups, use `{capture}`. If you meant to literall@khry match a segment starting with a colon, call `without_v07_checks` on the router.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

cc @wyatt-herkamp @krishnaTORQUE @davidpdrsn @jplatte

@waghanza waghanza added the release This PR contains results update label Jan 3, 2025
@wyatt-herkamp
Copy link
Contributor

wyatt-herkamp commented Jan 3, 2025

Starting in Axum 0.8 path variables went from being declared like :user to being declared like {user}

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 3, 2025

Yes, sorry for the ping. I've noticed it in tokio-rs/axum#2645

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 3, 2025

@trikko @whiplash could you check serverino implementation plz ? CI is failing

@trikko
Copy link
Contributor

trikko commented Jan 3, 2025

@trikko @whiplash could you check serverino implementation plz ? CI is failing

Try building with last version (0.7.14)

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 3, 2025

Thanks, it's working @trikko

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 3, 2025

When I try to compile httpz with zig build -Doptimize=ReleaseFast, I have

thread 26 panic: reached unreachable code
Panicked during a panic. Aborting.
error: the following build command crashed:
/home/ziguser/.zig-cache/o/a1900f3a86f3a4650490386b5a009115/build /usr/local/zig/zig /home/ziguser /home/ziguser/.zig-cache /home/ziguser/.cache/zig --seed 0x4541726d -Zaa0959d512e2acaa -Doptimize=ReleaseFast

Any idea @karlseguin @Kayden1412 @zigster64 ?

I'm on aarch64 using

const std = @import("std");

@Kayden1412
Copy link
Contributor

@waghanza #7961 (comment)

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 4, 2025

I wonder how bun make for being compiled on ARM then ;-) @Kayden1412

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 4, 2025

@kpicaza any plan to support 8.4 ?

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 4, 2025

I can not test with ice or phalcon with php 8.4 due to missing file #include <ext/standard/php_rand.h>

any idea @mruz @niden ?

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 4, 2025

@snowbldr The version of uwebsockets in https://github.com/SRFNStack/spliffy/blob/2e56844d4102cd6279c8dceb9fbe283da6032086/package.json#L36
is not compatible with the last LTS of node

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 4, 2025

@mimiMonads for vixeny-bun, I have

root@b05a5df00cca:/usr/src/app# bun run app.ts
1 | const app = await import('./server.ts')
2 |
3 | Bun.serve({
4 |   fetch: await app.compose(),
                       ^
TypeError: app.compose is not a function. (In 'app.compose()', 'app.compose' is undefined)
      at /usr/src/app/app.ts:4:20

Bun v1.1.42 (Linux arm64)

@niden
Copy link

niden commented Jan 4, 2025

I can not test with ice or phalcon with php 8.4 due to missing file #include <ext/standard/php_rand.h>

any idea @mruz @niden ?

Phalcon does not have support for PHP 8.4 yet. We are working on it

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 5, 2025

I have switch to pm2 6 (yes, still in beta) for bun (I needed before to disable reuse-port), except for :

  • stricjs
  • express
  • elysia
  • fastify
  • vixeny

Seems like reuse-port is enabled by default for those libs, and then pm2 could not run 😛

If you know how to disable this ... any help is ❤️ appreciated

As for now, I use the old cluster.ts way (exec ditsmod that use a custom solution)

cc @mario-huang @mcollina @SaltyAom @aquapi @KostyaTretyak @mimiMonads

@mcollina
Copy link
Collaborator

mcollina commented Jan 5, 2025

I would not recommend using pm2 in any benchmarks, as it monkeypatches some things inside core, making the benchmark about pm2.

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 6, 2025

What do you recommend then @mcollina ? The idea is to mimic production use, and mainly to spread on all cores

@KostyaTretyak
Copy link
Contributor

@waghanza, I also think you don't need to use pm2 in your tests at all. Which of its features do you use at work? Restart the process? But why is it in the case of benchmarks? I think that if one of the frameworks crashes when it has such a simple code, then there is no need to raise it. Let the maintainers take care of its proper settings.

You also using pm2 for cluster mode. But in this case, it is better to use the native code for the corresponding web server, because in the case of Node.js - this is one way, and in the case of Bun.js - it is another way.

for Node.js:

import cluster from 'node:cluster';
import { availableParallelism } from 'node:os';

const numCpus = availableParallelism();

if (numCpus > 1 && cluster.isPrimary) {
  for (let i = 0; i < numCpus; i++) {
    cluster.fork();
  }
} else {
  // here past your code to create the app and webserver
  app.server.listen(3000, '0.0.0.0');
}

for Bun.js:

import { availableParallelism } from 'node:os';

const numCpus = availableParallelism();

for (let i = 0; i < numCpus; i++) {
  Bun.spawn(['bun', 'app.ts'], { // here may be replace it with "*.js"
    stdio: ['inherit', 'inherit', 'inherit'],
    env: { ...process.env },
  });
}

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 6, 2025

I understand your points @KostyaTretyak @mcollina. The idea is to mimic production usage, mainly with pm2 (or alternative), but we do not need them here, because :

  • it could change results (add a little overhead)
  • no need of its feature
  • we do not test any framework features

Agree. It's better to stick to native solution.

Let's use native solution for durian.js then @mario-huang

@zigster64
Copy link

zigster64 commented Jan 6, 2025

When I try to compile httpz with zig build -Doptimize=ReleaseFast, I have

thread 26 panic: reached unreachable code
Panicked during a panic. Aborting.
error: the following build command crashed:
/home/ziguser/.zig-cache/o/a1900f3a86f3a4650490386b5a009115/build /usr/local/zig/zig /home/ziguser /home/ziguser/.zig-cache /home/ziguser/.cache/zig --seed 0x4541726d -Zaa0959d512e2acaa -Doptimize=ReleaseFast

Any idea @karlseguin @Kayden1412 @zigster64 ?

I'm on aarch64 using

const std = @import("std");

Thanks - will have a look, although looking through your code + build config + dockerfile, I dont see anything obvious :(

I do have 1 situation where I get this exact same error, and haven't had time to go through a solution yet (just worked around it in the interim)

The situation where I can reproduce the same "panic during panic" error is :

  • I have a repo using zig latest 0.14.dev, and httpz
  • Builds fine on local
  • docker build also works fine when I run it on my dedicated and up to date docker server
  • Drone CI build fails with this exact same error for a linux-x86_64 build. Hmmm. (Drone pulls the repo, and builds from the dockerfile)
  • My dockerfile that works on local and fails on drone looks similar to yours - base off Debian, manually fetch and untar zig, then zig build with optimize=ReleaseFast

Only differences I can think of between the Drone CI instance that fails with this error, and my own docker server is

  • Drone CI is running under Alpine, which uses musl and busybox compared to Debian full
  • Drone CI machine is running linux, but an older kernel compared to my more up to date and working docker server

Will have to double check which linux kernel version is on the failing machine - I think it's the previous Ubuntu LTS version 20.x or something. Will have to double check that

I know that I spun up a quick vultr Ubuntu server on the same old kernel version, and tried zig build from there - that worked fine

I also tried spinning up a vultr Alpine based server and tried zig build of the project from there - that worked fine as well, although it was running the newer kernel compared to the Drone CI linux kernel that was failing

So yeah - not a solution, but some more clues towards a solution maybe. The error Im getting during compile happens pretty quickly in the build process (about 5 seconds in), and is the exact same error that you are seeing "Panic during panic"

I put it down to some weird combination of linux kernel + musl + zig version for the time being, with a note to look deeper into it in the new year. Its now the new year :)

Another red herring is that my repo also uses a C library to write XLSX files - so I was thinking that might be part of my problem as well. Not sure yet

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 7, 2025

Thanks @zigster64 for heads up. You provide some meaningful insights. If this project could help any community, zig here, it will be 👍🏻

The dockefile is use is

FROM debian:bullseye-slim AS build

# Set a non-root user for added security
RUN useradd -m ziguser

# Install dependencies (update to latest secure versions)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    wget xz-utils \
    ca-certificates && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Download the latest stable Zig binary from the official website
ARG ZIG_VERSION=0.13.0
RUN wget https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz

RUN tar -xvf zig-linux-aarch64-0.13.0.tar.xz

RUN mv zig-linux-aarch64-0.13.0 /usr/local/zig

# Add Zig to the PATH
ENV PATH="/usr/local/zig:$PATH"

WORKDIR /home/ziguser

COPY 'build.zig' 'build.zig'
RUN chown ziguser build.zig
COPY 'src/main.zig' 'src/main.zig'
RUN chown ziguser src/main.zig
COPY 'build.zig.zon' 'build.zig.zon'
RUN chown ziguser build.zig.zon
RUN chown -R ziguser src

# Switch to the non-root user
USER ziguser

RUN zig build -Doptimize=ReleaseFast

FROM debian

RUN apt-get -qq update
RUN apt-get -qy install ca-certificates curl

COPY --from=build /app/zig-out/bin/httpz /server

ENTRYPOINT ["/home/ziguser/server"]

HEALTHCHECK CMD curl --fail http://0.0.0.0:3000 || exit

@waghanza
Copy link
Collaborator Author

waghanza commented Jan 7, 2025

After taking a closer look, the debian version in use is different : 11 for compilation step and 12 to run.

I have change this for

FROM debian:12-slim AS build

# Set a non-root user for added security
RUN useradd -m ziguser

# Install dependencies (update to latest secure versions)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    wget xz-utils \
    ca-certificates && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Download the latest stable Zig binary from the official website
ARG ZIG_VERSION=0.13.0
RUN wget https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz

RUN tar -xvf zig-linux-aarch64-0.13.0.tar.xz

RUN mv zig-linux-aarch64-0.13.0 /usr/local/zig

# Add Zig to the PATH
ENV PATH="/usr/local/zig:$PATH"

WORKDIR /home/ziguser

COPY 'build.zig' 'build.zig'
RUN chown ziguser build.zig
COPY 'src/main.zig' 'src/main.zig'
RUN chown ziguser src/main.zig
COPY 'build.zig.zon' 'build.zig.zon'
RUN chown ziguser build.zig.zon
RUN chown -R ziguser src

# Switch to the non-root user
USER ziguser

RUN zig build -Doptimize=ReleaseFast

FROM debian:12-slim

RUN apt-get -qq update
RUN apt-get -qy install ca-certificates curl

COPY --from=build /app/zig-out/bin/httpz /server

ENTRYPOINT ["/home/ziguser/server"]

HEALTHCHECK CMD curl --fail http://0.0.0.0:3000 || exit

but no change

@waghanza waghanza closed this Jan 7, 2025
@waghanza waghanza deleted the update branch January 7, 2025 19:38
@waghanza waghanza reopened this Jan 7, 2025
@waghanza
Copy link
Collaborator Author

waghanza commented Jan 7, 2025

Seems to compile on CI (x86_64)

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

@KostyaTretyak for ditsmod with bun, I have

root@61c11c0cf12c:/usr/src/app# bun run src/main.ts
1 | (function (entry, fetcher)
              ^
SyntaxError: export 'ValueProvider' not found in './types-and-models.js'

@KostyaTretyak
Copy link
Contributor

Because Bun has a bug, it cannot run TypeScript code without first compiling it. So, the correct script to run it is:

npm run build
npm start

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

Ok @KostyaTretyak, but I have some syntax error

root@c1a46153e95f:/usr/src/app# bun install --production && tsc -b
bun install v1.2.2 (c1708ea6)

Checked 62 installs across 66 packages (no changes) [5.00ms]
src/main.ts:1:21 - error TS2307: Cannot find module 'node:cluster' or its corresponding type declarations.

1 import cluster from "node:cluster";
                      ~~~~~~~~~~~~~~

src/main.ts:2:36 - error TS2307: Cannot find module 'node:http' or its corresponding type declarations.

2 import type { ServerOptions } from "node:http";
                                     ~~~~~~~~~~~

src/main.ts:3:38 - error TS2307: Cannot find module 'node:os' or its corresponding type declarations.

3 import { availableParallelism } from "node:os";
                                       ~~~~~~~~~


Found 3 errors.

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

and fo rnode,

 > [12/15] RUN tsc -b:
0.659 src/main.ts(2,36): error TS2307: Cannot find module 'node:http' or its corresponding type declarations.

@KostyaTretyak
Copy link
Contributor

Try without --production:

bun install
bun run build
bun run start

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

Seems to work for bun and node

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

@mimiMonads for vixey, I have

6.679 error: Relative import path "pug" not prefixed with / or ./ or ../ and not in import map from "https://deno.land/x/[email protected]/src/pug/pugRender.ts"
6.679     at https://deno.land/x/vixeny_prespective@v0.3.2/src/pug/pugRender.ts:9:28

when using deno install

  • deno.json
{
  "imports": {
    "vixeny": "jsr:@vixeny/core",
    "vixeny-perspective": "https://deno.land/x/[email protected]/main.ts",
    "vixeny-plugins": "jsr@vixeny/[email protected]",
    "@feathersjs/schema": "npm:@feathersjs/schema",
    "@sinclair/typebox": "npm:@sinclair/typebox@latest"
  }
}
  • package.json
{
  "dependencies": {
    "vixeny": "~0.1.52"
  }
}

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

@Kayden1412 when building http (zig 0.13) I have

 > [build 15/15] RUN zig build -Doptimize=ReleaseFast:
0.743 /home/ziguser/build.zig.zon:9:21: error: hash mismatch: manifest declares 12208c1f2c5f730c4c03aabeb0632ade7e21914af03e6510311b449458198d0835d6 but the fetched package has 12203254adcaba63705ff7ecf1894a5a26d5a5a0a9cfecd01423775fa5566b625138

The dockerfile is

FROM debian:12-slim AS build

# Set a non-root user for added security
RUN useradd -m ziguser

# Install dependencies (update to latest secure versions)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    wget xz-utils \
    ca-certificates && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Download the latest stable Zig binary from the official website
ARG ZIG_VERSION=0.13.0
RUN wget https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz

RUN tar -xvf zig-linux-aarch64-0.13.0.tar.xz

RUN mv zig-linux-aarch64-0.13.0 /usr/local/zig

# Add Zig to the PATH
ENV PATH="/usr/local/zig:$PATH"

WORKDIR /home/ziguser

COPY 'build.zig' 'build.zig'
RUN chown ziguser build.zig
COPY 'src/main.zig' 'src/main.zig'
RUN chown ziguser src/main.zig
COPY 'build.zig.zon' 'build.zig.zon'
RUN chown ziguser build.zig.zon
RUN chown -R ziguser src

# Switch to the non-root user
USER ziguser

RUN zig build -Doptimize=ReleaseFast

FROM debian:12-slim

RUN apt-get -qq update
RUN apt-get -qy install ca-certificates curl

COPY --from=build /app/zig-out/bin/httpz /server

ENTRYPOINT /server

HEALTHCHECK CMD curl --fail http://0.0.0.0:3000 || exit

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

@wolfy-j @butschster @msmakouz @roxblnfk I have

 0.128 Deprecated: Constant E_STRICT is deprecated in /usr/src/app/public/index.php on line 13
0.139 [ErrorException]
0.139 Spiral\YiiErrorHandler\HtmlRenderer::render(): Implicitly marking parameter $format as nullable is deprecated, the explicit nullable type must be used instead in vendor/spiral-packages/yii-error-handler-bridge/src/HtmlRenderer.php:25
0.139 [ErrorException]
0.139 Constant E_STRICT is deprecated in public/index.php:13

on php 8.4 and road runner config

version: "3"
rpc:
  listen: "tcp://127.0.0.1:6001"
http:
  address: "0.0.0.0:3000"
server:
  command: "php public/index.php"
  relay: pipes

any idea ?

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

Failings frameworks

  • pedestal
  • veb
  • may_minihttp
  • vixeny-deno
  • spiral
  • turbo
  • httpz
  • spark
  • luminus
  • act
  • scorper
  • bottle
  • struts2
  • hexagon-netty
  • vweb
  • hexagon-netty-epoll
  • armeria
  • kore
  • hexagon-jetty
  • helidon-se
  • responder

@waghanza
Copy link
Collaborator Author

waghanza commented Feb 9, 2025

I'll merge this one @the-benchmarker/web-frameworks for monday, there be a lot of change

@roxblnfk
Copy link
Contributor

roxblnfk commented Feb 9, 2025

@wolfy-j @butschster @msmakouz @roxblnfk I have

 0.128 Deprecated: Constant E_STRICT is deprecated in /usr/src/app/public/index.php on line 13
0.139 [ErrorException]
0.139 Spiral\YiiErrorHandler\HtmlRenderer::render(): Implicitly marking parameter $format as nullable is deprecated, the explicit nullable type must be used instead in vendor/spiral-packages/yii-error-handler-bridge/src/HtmlRenderer.php:25
0.139 [ErrorException]
0.139 Constant E_STRICT is deprecated in public/index.php:13

on php 8.4 and road runner config

any idea ?

Hi
Try to replace this

\error_reporting(E_ALL | E_STRICT ^ E_DEPRECATED);

with this:

\error_reporting(E_ALL ^ E_DEPRECATED);

@waghanza waghanza merged commit 0cf3061 into master Feb 10, 2025
242 of 257 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release This PR contains results update
Projects
None yet
Development

Successfully merging this pull request may close these issues.