-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
CPU emulator leads to strange memory issues #3312
Comments
The bug is a memory issue. The text is stack memory Doesn't reproduce on macOS, but will try on Linux |
I tried it on a recent version of linux, it just doesn't do anything. no output (just keeps it alive) |
on Debian 10 Kernel 4.19.0-24-amd64 and on Debian 12 Kernel 6.1.0-9-amd64, got no error, just keep the process alive because the server is alive on port 3000. Will try with Ubuntu 20.04 |
Bun.serve()
.
Any progress on it? @cirospaciari |
We a
We added better validation on |
Still error, but error message is now shorter: $ wget https://github.com/oven-sh/bun/releases/download/canary/bun-linux-x64.zip
$ unzip bun-linux-x64.zip
$ ./bun-linux-x64/bun bug.js
1 | Bun.serve();
^
TypeError: 畂敳癲硥数瑣湡漠橢捥t慔扲污䙬楡敬呤䕯瑸慲瑣椀慭
code: "ERR_INVALID_ARG_TYPE"
at �����������������������������������������:1:0
$ ./bun-linux-x64/bun bug.js 2>&1 | xxd
00000000: 3120 7c20 4275 6e2e 7365 7276 6528 293b 1 | Bun.serve();
00000010: 0a20 2020 5e0a 5479 7065 4572 726f 723a . ^.TypeError:
00000020: 20e7 9582 e2b9 aee6 95b3 e799 b2e2 81a5 ...............
00000030: e7a1 a5e6 95b0 e791 a3e2 81b3 e6b9 a1e6 ................
00000040: bca0 e6a9 a2e6 8da5 74e6 8594 e689 b2e6 ........t.......
00000050: b1a1 e499 ace6 a5a1 e695 ace5 91a4 e495 ................
00000060: afe7 91b8 e685 b2e7 91a3 e6a4 80e6 85ad ................
00000070: 0a20 636f 6465 3a20 2245 5252 5f49 4e56 . code: "ERR_INV
00000080: 414c 4944 5f41 5247 5f54 5950 4522 0a0a ALID_ARG_TYPE"..
00000090: 2020 2020 2020 6174 2000 0000 0000 0000 at .......
000000a0: 00aa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
000000b0: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
000000c0: aaaa aaaa aaaa aaaa aaaa 3a31 3a30 0a ..........:1:0. |
@cirospaciari we hit another case, any further progress with this? |
Also happening on my end (since bun 0.7.0) Linux 5.10.0-23-amd64 x86_64 unknown
|
Still not able to reproduce, @Northernside can you share more info about your system like processor name etc? Some systems I tried: OS: macOS 13.3 22E252 arm64 OS: Debian GNU/Linux trixie/sid x86_64 OS: Ubuntu 22.04.2 LTS x86_64 and the same on Debian 10 basically, this is the expected behavior for |
It didn't occur on my macOS (Sonoma, latest beta) but it does on my VPS hosted by Dashserv (German hoster). My VPS runs under Qemu (at least that's what I believe?) so all hardware outputs tell some weird ass things, but anyway: |
Also, I can give you full SSH access to my system on which it's bugging out lol - maybe this can help you debug stuff quicker? |
The original bug was caused by incorrect arguments type checking in The error @Northernside is seeing appears to be due to using bun-linux-x64 when the machine should be using bun-linux-x64-baseline. Bun's install script is meant to auto-detect this, but if installed through Docker or on a machine which does support avx2, it will install the wrong choice. @Northernside please use the .tar.gz from https://github.com/oven-sh/bun/releases/download/bun-${version}/bun-linux-x64-baseline.zip instead of https://github.com/oven-sh/bun/releases/download/bun-${version}/bun-linux-x64.zip. In the future, we will make this work better to not need this step. |
Sorry to bother you again, I don't know if I did something wrong, or not, but even when switching to I made it so that it'll always grab the baseline archive in the installer (that's why I did the grep output, don't get confused). |
Any updates on this? |
Does this happen for any call to Bun.serve() or specifically ones with invalid arguments (eg It’s very confusing why this could still be happening and why it doesn’t seem to reproduce on any hardware I’ve tried. |
I know, I know, this might annoy you, but are you up to testing/debugging it with my hardware? I want to be able to use the newer versions of bun because they also fix a lot of issues which I'm currently experiencing on 0.6.9 (e.g. a LOT of segfaults and compatibility issues). |
Oh btw I have to correct myself, it's not from 0.6.9 -> 0.7.0 but from 0.6.9 -> 0.6.10 when this issue started occurring. |
@Northernside if you explicitly set |
I fix this issue by changing VPS provider |
Hello, sorry it's still not clear to me, and i'm still stuck with this From my understading, Bun is compatible with non AVX2 machines, thanks to the baseline version. The install script is detecting AVX2 support, and fetch the correct version. Am I right? But in my situation, it does not seems to works. I would like to run Bun on production on a VPS with Ubuntu 2204. The Does that means i not to find another hoster? EDIT:
Previously the CPU name something like "KVM Common CPU" |
I'm getting the same Issue on an Ubuntu VPS, where I can't change the VM settings. I'm getting the same issue whether I use the bun installer, or download the baseline version. I'm using Bun /z$ bun main.ts
1 | Bun.serve();
^
TypeError: 畂敳癲硥数瑣湡漠橢捥t硅数瑣摥眠扥潳正瑥琠敢愠
code: "ERR_INVALID_ARG_TYPE"
at /z/main.ts:1:1 /z$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
/z$ uname -a
Linux [redacted] 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
/z$ grep avx2 /proc/cpuinfo
/z$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 107
model name : QEMU Virtual CPU version 2.5+
stepping : 1
microcode : 0x1
cpu MHz : 3599.936
cache size : 16384 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 7199.87
clflush size : 64
cache_alignment : 128
address sizes : 40 bits physical, 48 bits virtual
power management:
/z$ |
I think it may not be a memory issue, it can be decoded into (unicode to iso-8859-1)
it exists in Line 1003 in 3447bc2
and
can be decoded into
while |
@codehz Thanks! I changed my code to: Bun.serve({
fetch(req, server) { },
}); And the error can be decoded with this python: message = '湕捩摯潨瑳慮敭畭瑳愠牬慥祤戠湥潣敤潦潮渊睥唠䱒椨灮瑵⸩潨瑳慮敭猠潨汵潤琠敨琠楲正.慢敳剕⁉慣❮⁴慨敶愠甠敳湲浡牯瀠獡睳牯d'
message.encode('utf-16').decode('iso-8859-1')
Edit: Error still happening in bun 1.0.25 |
const fastify = require('fastify')({
logger: false
})
const path = require('path')
fastify.register(require('@fastify/static'), {
root: path.join(__dirname, 'public'),
})
fastify.listen({ port: 3000 }, (err, address) => {
if (err) throw err
}) Throws very similar errors for me too, on a VM running inside Proxmox:
Bun version: 1.0.26 |
I was running into exactly this issue on VBox and Bun v1.0.29. |
@Jarred-Sumner Seems like people still have this issue, should this be reopened? |
can confirm still happening on bun 1.1.2 :( |
same issue here! |
any solution in local found docker image. but in vps TypeError: 湕捩摯潨瑳? |
I have the same issues in Bun v1.1.8 on a VPS with baseline version |
Seems like people still have this issue, even with the baseline version, should this be reopened? |
One way to solve this issue that I found for Proxmox is to set the VM CPU type to "Host" which fixes the issue for that VM. Thanks to @ahoys for noticing this! #3312 (comment) |
how to set it?, like not everyone has the option to modify the type! |
For people who not able to set CPU type, you can try this https://gist.github.com/yus-ham/36f75733f26f832efe071664cf638054 |
|
The solution
edited
Download the build of Bun with “baseline” in the name
https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-baseline.zip
if using Proxmor, follow this screenshot
Original issue:
What version of Bun is running?
0.6.9
What platform is your computer?
Linux 5.4.0-45-generic x86_64 x86_64
What steps can reproduce the bug?
repro.js
(It is a minimal reproduction)
What is the expected behavior?
Bun starts a server (which does nothing).
What do you see instead?
Additional information
The repro above is just for testing. I ran into this error while trying to run an actual app inside a Docker container.
I went ahead and downloaded https://github.com/oven-sh/bun/releases/download/bun-v0.6.9/bun-linux-x64.zip and run it outside the Docker container and get the same error and reduced the code to the above repro script. The host OS is Ubuntu 20.04.
The text was updated successfully, but these errors were encountered: