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

Docker error: CODE_MOVED for unknown code block? #1472

Closed
adronitis opened this issue Dec 5, 2023 · 14 comments · Fixed by #2037
Closed

Docker error: CODE_MOVED for unknown code block? #1472

adronitis opened this issue Dec 5, 2023 · 14 comments · Fixed by #2037

Comments

@adronitis
Copy link

Running wrangler dev --port=8000 inside Docker with:

/* eslint-disable */
import { Router } from 'itty-router'

const router = Router()
const routes =  JSON.parse(ROUTES)
const proxyTo = hostname => async request => {

  const url = new URL(request.url);
  const forwardedHost = url.hostname;
  url.hostname = hostname;

  const req = new Request(url, request);
  req.headers.append('X-Forwarded-Host', forwardedHost);

  return fetch(req);
}

routes.forEach(route => {
  router.all(route, proxyTo(FRONTEND_HOST));
});

router.all('/api/*', proxyTo(BACKEND_HOST))
router.all('/*', proxyTo(BACKEND_HOST))

addEventListener('fetch', (e) => {
  e.respondWith(router.handle(e.request))
})

Everything works fine if I run this outside of Docker, but if I put everything in Docker, when I want to do the proxy, I get:

worker-router-worker-1  | ✘ [ERROR] workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block?
worker-router-worker-1  |
worker-router-worker-1  |   workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block?
worker-router-worker-1  |   workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block?
worker-router-worker-1  |   workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block?
worker-router-worker-1  |

worker-router-worker-1  | ✘ [ERROR] workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block?
worker-router-worker-1  |
worker-router-worker-1  |   workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block?
worker-router-worker-1  |

worker-router-worker-1  | ✘ [ERROR] workerd/server/server.c++:2838: error: Uncaught exception: kj/compat/http.c++:1725: failed: expected headerBuffer.size() < MAX_BUFFER [131072 < 131072]; request headers too large
worker-router-worker-1  |
worker-router-worker-1  |   stack: /usr/local/lib/node_modules/wrangler/node_modules/@cloudflare/workerd-linux-arm64/bin/workerd@265008c /usr/local/lib/node_modules/wrangler/node_modules/@cloudflare/workerd-linux-arm64/bin/workerd@2652620 /usr/local/lib/node_modules/wrangler/node_modules/@cloudflare/workerd-linux-arm64/bin/workerd@2656798 /usr/local/lib/node_modules/wrangler/node_modules/@cloudflare/workerd-linux-arm64/bin/workerd@2622b74
worker-router-worker-1  |
[mf:err] Error: Network connection lost.
[mf:inf] GET /terms 500 Internal Server Error (88ms)

Individual URL for the host (eg. front-end) works fine from Docker.
Not exactly sure what the headerBuffer.size() and where that could be? Could this due to some host settings within Docker?

@johnpyp
Copy link

johnpyp commented Dec 11, 2023

I'm also getting this error, but not just in Docker. It seems to have been introduced in wrangler 3.18 or 3.19, as 3.17 does not have this issue for me.

@adronitis
Copy link
Author

I'm also getting this error, but not just in Docker. It seems to have been introduced in wrangler 3.18 or 3.19, as 3.17 does not have this issue for me.

That's strange, our Docker env was using 3.17 but still got this error.

@kentonv
Copy link
Member

kentonv commented Dec 11, 2023

This message is not really an error, at least not one that's relevant to most people. This is another example where our logging is highlighting bugs meant for the workers runtime team to look into. In this case V8's API for mapping JITed memory in order to construct stack traces isn't working the way we expect. This has been firing occasionally for a long time. There's actually no impact for workerd users since this information is only used when generating crash dumps in our internal codebase.

@johnpyp
Copy link

johnpyp commented Dec 11, 2023

Hmm, for me it's the only noticeable difference between my worker responding on 3.17 and hanging on 3.19. Maybe it just coincides with another breaking change rather than the cause?

@MattIPv4
Copy link

MattIPv4 commented Jan 7, 2024

👋 If it helps in debugging this, I'm reliably seeing this for one set of our tests w/ Miniflare: https://github.com/cdnjs/api-server/actions/runs/7440877000/job/20242359379

@kentonv
Copy link
Member

kentonv commented Jan 8, 2024

TBH we should remove the logging for this error as it's unlikely anyone is going to spend time debugging it... it just doesn't matter that much.

@tddschn
Copy link

tddschn commented Jan 13, 2024

I got the same workerd/jsg/setup.c++:481: error: CODE_MOVED for unknown code block? error when running wrangler pages dev ./build on 3.22 and 3.17.

Pages site is not served, got thousands of 500 internal server error lines.

@kentonv
Copy link
Member

kentonv commented Jan 13, 2024

@tddschn Sorry, the CODE_MOVED message has nothing to do with any other problems you're seeing.

@allsey87
Copy link

allsey87 commented Mar 21, 2024

I am still seeing this issue in 3.36.0. Perhaps the priority of this issue can be bumped up a bit? Even if it is benign, it makes spotting other errors/warnings in logs more difficult.

Actually, this warning disappears for me when I remove the --reference-types argument from wasm-bindgen-cli

@KeKs0r
Copy link

KeKs0r commented Mar 22, 2024

I am starting to see them more often in CI and they seem to coincide with some process crashing. Since whenever I see these, my tests timeout. I know most comments indicate, that they should not be relevant, but could we get some more background info?

@adronitis
Copy link
Author

I am starting to see them more often in CI and they seem to coincide with some process crashing. Since whenever I see these, my tests timeout. I know most comments indicate, that they should not be relevant, but could we get some more background info?

Same here, we concluded the same results. But yeah more background info would indeed be nice.

@Zxilly
Copy link

Zxilly commented Mar 28, 2024

got the same error with wrangler 3.39.0

https://gist.github.com/Zxilly/9273aa5909f539db3f0dc8736aaab9bd

> r2-image-host@0.0.1 dev
> wrangler dev

 ⛅️ wrangler 3.39.0
-------------------
Your worker has access to the following bindings:
- R2 Buckets:
  - IMG_BUCKET: img-bucket
⎔ Starting local server...
[wrangler:inf] Ready on http://127.0.0.1:8787
X [ERROR] workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?

  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?


[wrangler:inf] PUT /test.png 201 Created (555ms)
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit                                                                                                                                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

@gh0sTedBuddy
Copy link

trying to batch insert rows into a d1 table when all of a sudden these error messages popped up (on random occassions within the process. the requests are still being completed though but still its irritating since you're debugging until you finally find these statements in this issue, that these are not related to your code. weird.

✘ [ERROR] workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?

  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?
  workerd/jsg/setup.c++:508: error: CODE_MOVED for unknown code block?

can we somehow catch them? or prepend them otherwise from being shown to the log?

kentonv added a commit that referenced this issue Apr 19, 2024
This log message indicates a problem with workerd itself, not with the application -- but it's a benign problem that doesn't cause any issues except possibly making crash dumps slightly less useful. This shouldn't be displayed to application developers, since there's nothing they can or should do about it.

Fixes #1472.
@kentonv
Copy link
Member

kentonv commented Apr 19, 2024

I made a PR (#2037) to remove this log message.

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 a pull request may close this issue.

9 participants