qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[🐞] pnpm run build hang when i use ioredis and bullmq

Open uratmangun opened this issue 1 year ago • 3 comments

Which component is affected?

Qwik Runtime

Describe the bug

continuing from this message https://discord.com/channels/842438759945601056/1070624203583262721/1208074251815358496 im trying to build my qwik app that uses bullmq to process a screenshot, and it hangs when i try to build it for production, i fix it by putting all the connection inside closure that way it doesnt start connection immediately this is my code when the build hangs:

https://gist.github.com/koisose/f4ff6f4a92c0451dd934372972e675a2

and then this is how i change it so it doesnt hang

https://gist.github.com/koisose/57e908ad50a910a561addd95dd287340

it quite hacky but it works

Reproduction

https://github.com/koisose/qwik-error-build

Steps to reproduce

first you need to change https://github.com/koisose/qwik-error-build/blob/main/src/utils/bullmq/config.ts to your own redis instance config you can use upstash

then if you want to see the error run pnpm run build it will hang like this:

image

System Info

System:
    OS: Linux 5.4 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (4) x64 Intel(R) Xeon(R) Platinum 8167M CPU @ 2.00GHz
    Memory: 21.61 GB / 29.09 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 21.6.1 - ~/.local/state/fnm_multishells/16556_1708123451816/bin/node
    npm: 10.2.4 - ~/.local/state/fnm_multishells/16556_1708123451816/bin/npm
    pnpm: 8.15.2 - ~/.local/share/pnpm/pnpm
  npmPackages:
    @builder.io/qwik: ^1.4.4 => 1.4.4 
    @builder.io/qwik-city: ^1.4.4 => 1.4.4 
    @builder.io/qwik-react: 0.5.0 => 0.5.0 
    undici: * => 6.6.2 
    vite: ^5.0.12 => 5.1.1

Additional Information

No response

uratmangun avatar Feb 16 '24 23:02 uratmangun

It would be great if we could get a minimal repro of this. It doesn't need to be a working app, just the minimal source that causes the optimizer to hang.

wmertens avatar Feb 17 '24 04:02 wmertens

It would be great if we could get a minimal repro of this. It doesn't need to be a working app, just the minimal source that causes the optimizer to hang.

yes sir heres the repro link https://github.com/koisose/qwik-error-build just run:

pnpm i
pnpm run build

and i also include the fix here https://github.com/koisose/qwik-error-build/blob/main/src/utils/bullmq/queue-fix.ts this is not optimal i know but it is enough for my use case

uratmangun avatar Feb 17 '24 05:02 uratmangun

I accidentally stumbled upon an issue. I was developing with Ubuntu v20, and everything was working fine. However, when I switched to Ubuntu 22.04, the server build process would not end execution. I couldn't figure out the problem, but it seems that the Qwik server build process executes the code at the build time to create necessary pages. During execution, it tries to resolve dependencies, but, weirdly, it can't resolve ioredis and bullmq. Although, if the build.server command exits at the end, there is no problem running the application.

But in the end, this happens only when the ssg flag is not disabled on the server adapter. If it is null, since the server build is not trying to create static pages, there is no hanging.

saeedhbi avatar Mar 05 '24 10:03 saeedhbi

@koisose Did you solve this issue? is it related to Ubuntu?

gioboa avatar Jun 17 '24 19:06 gioboa

Hello @koisose. Please provide the missing information requested above. Issues marked with STATUS-2: missing info will be automatically closed if they have no activity within 14 days. Thanks 🙏

github-actions[bot] avatar Jun 17 '24 19:06 github-actions[bot]

@gioboa i have solved it, but i dont know if its the right way to do it as i said in the description i solve it like this https://gist.github.com/koisose/57e908ad50a910a561addd95dd287340 you can close it if you want to

uratmangun avatar Jun 19 '24 01:06 uratmangun

@koisose I see, thanks for your answer. I'm glad that you solved this, it's a particular scenario and this fix looks okayish to me. So I close this issue, thanks 👍

gioboa avatar Jun 19 '24 05:06 gioboa