Skip to content

Conversation

@nojaf
Copy link
Member

@nojaf nojaf commented Nov 27, 2025

So, my project over at nojaf/rescript-kaplay@2f34e58 was hanging this morning.
bsc.exe was in an infinite loop.

The LLM and I chatted about this and we found that the problem was an infinite recursion in compiler/core/js_exp_make.ml.

I added the technical context in debug_compiler_hang.md.

@cristianoc could you take a look at this please?

I was not able to reproduce this outside of my own project.
So, this might be a quite specific edge-case 🤔

@nojaf nojaf requested a review from cristianoc November 27, 2025 09:23
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 27, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@8039

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@8039

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@8039

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@8039

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@8039

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@8039

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@8039

commit: 04485c4

@cristianoc
Copy link
Collaborator

Where's the self contained repro of a few lines?

@cristianoc
Copy link
Collaborator

Can't review without a repro.

@nojaf
Copy link
Member Author

nojaf commented Nov 27, 2025

Where's the self contained repro of a few lines?

While I understand that request, I can't reproduce it with the problematic code in a single file. I do not know what exactly trigger it, thus it must be some very unique combination.

git clone --no-checkout https://github.com/nojaf/rescript-kaplay.git
cd rescript-kaplay
git checkout 2f34e581f346bff016bcc99126ba9656565f7ca6
bun i 
bunx rescript

@cristianoc
Copy link
Collaborator

Where's the self contained repro of a few lines?

While I understand that request, I can't reproduce it with the problematic code in a single file. I do not know what exactly trigger it, thus it must be some very unique combination.

git clone --no-checkout https://github.com/nojaf/rescript-kaplay.git
cd rescript-kaplay
git checkout 2f34e581f346bff016bcc99126ba9656565f7ca6
bun i 
bunx rescript

Can you reproduce it on the full repo, and reproduce it going away after the fix in this PR?

@nojaf
Copy link
Member Author

nojaf commented Nov 27, 2025

Yep, I tried to mention this in https://github.com/rescript-lang/rescript/pull/8039/files#diff-e4faf79cc44b60806dfcf3de513d06c907723189948ac3738b02d4939252f523R109-R128

Works for that change but not for v12 stable.

@cristianoc
Copy link
Collaborator

Yep, I tried to mention this in https://github.com/rescript-lang/rescript/pull/8039/files#diff-e4faf79cc44b60806dfcf3de513d06c907723189948ac3738b02d4939252f523R109-R128

Works for that change but not for v12 stable.

can you ask the agent to cut down your project little by little until what's left is small and still loops?

@cristianoc
Copy link
Collaborator

We want to make sure that we're not going after a red herring.

@nojaf
Copy link
Member Author

nojaf commented Nov 27, 2025

I'm able to trim some more in https://github.com/nojaf/rescript-kaplay/tree/minimal-repro

It seems related to https://github.com/nojaf/rescript-kaplay/blob/minimal-repro/packages/skirmish/src/Player.res#L12

Thundershock.cast(gameObj) is the root cause of the loop.

cristianoc added a commit that referenced this pull request Nov 28, 2025
@cristianoc
Copy link
Collaborator

Not an infinite loop: see repro
#8042

The original example is over-engineered, so it took some time to unentangle this.

Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See repro.
This is a perf issue not an infinite loop issue.
Ideally we want a solution that avoids the problem and does not change any of the current tests (unless there's a good reason to).
There are several ways to go about this, but prompting from a small repro should make this much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants