Git Product home page Git Product logo

Comments (7)

Jarred-Sumner avatar Jarred-Sumner commented on May 22, 2024

What Linux kernel version is in use on the VM?

from bun.

Zananok avatar Zananok commented on May 22, 2024

Updated original post with the kernel information:
uname -r (Kernel): 6.1.0-18-amd64

from bun.

Jarred-Sumner avatar Jarred-Sumner commented on May 22, 2024

Hm. Can you try perf trace bun install and paste the output? I'm wondering what system calls are being used shortly before it segfaults.

Another thing you could try: can you run bun install --ignore-scripts? I want to rule out whether or not it's related to postinstall scripts being run

Are there any unusual permission configurations being set? Is vfork allowed?

from bun.

Zananok avatar Zananok commented on May 22, 2024

I will do the perf trace soon and update the main topic, but the --ignore-scripts will work, but subsequently print the same error when running bun dev.

Edit: updated with both results.

Edit2: no, there are no 'unusual' settings being set on docker-compose, other than privileged: true and mounted volume: /sys/kernel/debug:/sys/kernel/debug:rw,nosuid,nodev,noexec,relatime for to be able to run perf. Originally these were not there. My other "settings" that I didn't post in the original post are: the port open (singular), timezone (Norway) and working dir: /app.

edit3: perf --version: perf version 5.10.209

from bun.

Jarred-Sumner avatar Jarred-Sumner commented on May 22, 2024

It appears that it is segfaulting on process start

 13818.593 ( 0.007 ms): bun/3061 fstat(fd: 116</memfd:spawn_stdio_stdout (deleted)>, statbuf: 0x7ffdd1e11ac0) = 0
 13818.606 ( 0.006 ms): bun/3061 pread64(fd: 116</memfd:spawn_stdio_stdout (deleted)>, buf: 0x4bcd8272180, count: 20) = 0
 13818.619 ( 0.005 ms): bun/3061 sched_getaffinity(len: 128, user_mask_ptr: 0x7ffdd1e11a98)            = 8
 13818.633 ( 0.023 ms): bun/3061 mmap(len: 4198400, flags: PRIVATE|ANONYMOUS|STACK)                    = 0x7f229e3f9000
 13818.662 ( 0.012 ms): bun/3061 mprotect(start: 0x7f229e3fa000, len: 4194304, prot: READ|WRITE)       = 0
error: postinstall script from "vue-demi" terminated by SIGSEGV (Address boundary error)
 13819.469 ( 0.252 ms): bun/3061 clone(clone_flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, newsp: 0x7f229e79d370, parent_tidptr: 0x7f229e7f99d0, child_tidptr: 0x7f229e7f99d0, tls: 0x7f229e7f9700) = 3109 (bun)
 13819.728 ( 0.004 ms): bun/3061 fstat(fd: 117</memfd:spawn_stdio_stderr (deleted)>, statbuf: 0x7ffdd1e11ac0) = 0
 13819.734 ( 0.004 ms): bun/3061 pread64(fd: 117</memfd:spawn_stdio_stderr (deleted)>, buf: 0x4bcd8272180, count: 20) = 0
 13819.752 ( 0.008 ms): bun/3061 write(fd: 2<pipe:[54635]>, buf: 0x7f22cf5853a4, count: 89)            = 89
 13819.763 ( 0.003 ms): bun/3061 rt_sigaction(sig: SEGV, act: 0x7ffdd1e11a70, sigsetsize: 8)           = 0
 15589.572 ( 0.009 ms): bun/3060 pread64(fd: 18</memfd:spawn_stdio_stdout (deleted)>, buf: 0x58e40272d80, count: 20) = 0
 15589.597 ( 0.014 ms): bun/3060 sched_getaffinity(len: 128, user_mask_ptr: 0x7ffc6548ab98)            = 8
 15589.624 ( 0.029 ms): bun/3060 mmap(len: 4198400, flags: PRIVATE|ANONYMOUS|STACK)                    = 0x7f08153f5000
 15589.663 ( 0.018 ms): bun/3060 mprotect(start: 0x7f08153f6000, len: 4194304, prot: READ|WRITE)       = 0
error: postinstall script from "vue-demi" terminated by SIGSEGV (Address boundary error)
 15589.936 ( 0.289 ms): bun/3060 clone(clone_flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, newsp: 0x7f0815799370, parent_tidptr: 0x7f08157f59d0, child_tidptr: 0x7f08157f59d0, tls: 0x7f08157f5700) = 3107 (bun)
 15590.239 ( 0.004 ms): bun/3060 fstat(fd: 119</memfd:spawn_stdio_stderr (deleted)>, statbuf: 0x7ffc6548abc0) = 0
 15590.246 ( 0.004 ms): bun/3060 pread64(fd: 119</memfd:spawn_stdio_stderr (deleted)>, buf: 0x58e40272d80, count: 20) = 0
 15590.273 ( 0.013 ms): bun/3060 write(fd: 2<pipe:[52255]>, buf: 0x7f08364ea3a4, count: 89)            = 89
 15590.290 ( 0.003 ms): bun/3060 rt_sigaction(sig: SEGV, act: 0x7ffc6548ab70, sigsetsize: 8)           = 0

from bun.

Zananok avatar Zananok commented on May 22, 2024

I don't mean that we should debug some else's library in a bun bug report, however, segfault of a js running in bun seems like its not the error that should occur if someone programmed a postinstall that does not take into account bun. Additionally, from the v1.1 video, it was recommended to report any "libraries" that didn't work in bun if they worked in npm. Strangely, it does work on WSL, as aforementioned, and it does work on docker using pnpm. For the record, I have also tried a debian:latest dockerfile with the curl -fsSL https://bun.sh/install | bash (resulting in the same segfault issue), so I assume there is no specific issue with oven/bun:latest.

Edit: My suspicion of the cause of the error is this code on utils.

// unlink for pnpm, #92
  try {
    fs.unlinkSync(dest)
  } catch (error) { }
  fs.writeFileSync(dest, content, 'utf-8')

Here is the source code of the files in question:

node_modules/vue-demi/scripts/postinstall.js

const { switchVersion, loadModule } = require('./utils')

const Vue = loadModule('vue')

if (!Vue || typeof Vue.version !== 'string') {
  console.warn('[vue-demi] Vue is not found. Please run "npm install vue" to install.')
}
else if (Vue.version.startsWith('2.7.')) {
  switchVersion(2.7)
}
else if (Vue.version.startsWith('2.')) {
  switchVersion(2)
}
else if (Vue.version.startsWith('3.')) {
  switchVersion(3)
}
else {
  console.warn(`[vue-demi] Vue version v${Vue.version} is not suppported.`)
}

node_modules/vue-demi/scripts/utils.js

const fs = require('fs')
const path = require('path')

const dir = path.resolve(__dirname, '..', 'lib')

function loadModule(name) {
  try {
    return require(name)
  } catch (e) {
    return undefined
  }
}

function copy(name, version, vue) {
  vue = vue || 'vue'
  const src = path.join(dir, `v${version}`, name)
  const dest = path.join(dir, name)
  let content = fs.readFileSync(src, 'utf-8')
  content = content.replace(/'vue'/g, `'${vue}'`)
  // unlink for pnpm, #92
  try {
    fs.unlinkSync(dest)
  } catch (error) { }
  fs.writeFileSync(dest, content, 'utf-8')
}

function updateVue2API() {
  const ignoreList = ['version', 'default']
  const VCA = loadModule('@vue/composition-api')
  if (!VCA) {
    console.warn('[vue-demi] Composition API plugin is not found. Please run "npm install @vue/composition-api" to install.')
    return
  }

  const exports = Object.keys(VCA).filter(i => !ignoreList.includes(i))

  const esmPath = path.join(dir, 'index.mjs')
  let content = fs.readFileSync(esmPath, 'utf-8')

  content = content.replace(
    /\/\*\*VCA-EXPORTS\*\*\/[\s\S]+\/\*\*VCA-EXPORTS\*\*\//m,
`/**VCA-EXPORTS**/
export { ${exports.join(', ')} } from '@vue/composition-api/dist/vue-composition-api.mjs'
/**VCA-EXPORTS**/`
    )

  fs.writeFileSync(esmPath, content, 'utf-8')

}

function switchVersion(version, vue) {
  copy('index.cjs', version, vue)
  copy('index.mjs', version, vue)
  copy('index.d.ts', version, vue)

  if (version === 2)
    updateVue2API()
}


module.exports.loadModule = loadModule
const fs = require('fs')
const path = require('path')

const dir = path.resolve(__dirname, '..', 'lib')

function loadModule(name) {
  try {
    return require(name)
  } catch (e) {
    return undefined
  }
}

function copy(name, version, vue) {
  vue = vue || 'vue'
  const src = path.join(dir, `v${version}`, name)
  const dest = path.join(dir, name)
  let content = fs.readFileSync(src, 'utf-8')
  content = content.replace(/'vue'/g, `'${vue}'`)
  // unlink for pnpm, #92
  try {
    fs.unlinkSync(dest)
  } catch (error) { }
  fs.writeFileSync(dest, content, 'utf-8')
}

function updateVue2API() {
  const ignoreList = ['version', 'default']
  const VCA = loadModule('@vue/composition-api')
  if (!VCA) {
    console.warn('[vue-demi] Composition API plugin is not found. Please run "npm install @vue/composition-api" to install.')
    return
  }

  const exports = Object.keys(VCA).filter(i => !ignoreList.includes(i))

  const esmPath = path.join(dir, 'index.mjs')
  let content = fs.readFileSync(esmPath, 'utf-8')

  content = content.replace(
    /\/\*\*VCA-EXPORTS\*\*\/[\s\S]+\/\*\*VCA-EXPORTS\*\*\//m,
`/**VCA-EXPORTS**/
export { ${exports.join(', ')} } from '@vue/composition-api/dist/vue-composition-api.mjs'
/**VCA-EXPORTS**/`
    )

  fs.writeFileSync(esmPath, content, 'utf-8')

}

function switchVersion(version, vue) {
  copy('index.cjs', version, vue)
  copy('index.mjs', version, vue)
  copy('index.d.ts', version, vue)

  if (version === 2)
    updateVue2API()
}


module.exports.loadModule = loadModule
module.exports.switchVersion = switchVersion

from bun.

Zananok avatar Zananok commented on May 22, 2024

I noticed now that once running bun install a second time, without cleaning up the env, another error occurs. Subsequent calls to bun just repeats the last error:

root@b0eae7d7ecee:/app# bun install
bun install v1.1.0 (5903a614)
  🚚 prompts... error: postinstall script from "vue-demi" terminated by SIGSEGV (Address boundary error)
Segmentation fault (core dumped)
root@b0eae7d7ecee:/app# bun install
bun install v1.1.0 (5903a614)

$ nuxt prepare
error: postinstall script from "nuxt-app" terminated by SIGSEGV (Address boundary error)
Segmentation fault (core dumped)
root@b0eae7d7ecee:/app# bun install
bun install v1.1.0 (5903a614)

$ nuxt prepare
error: postinstall script from "nuxt-app" terminated by SIGSEGV (Address boundary error)
Segmentation fault (core dumped)

Though I can't seem to find it's postinstall script:

❯ find . -iname "postinstall*"
./node_modules/vue-demi/scripts/postinstall.js

from bun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.