nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.27k stars 132 forks source link

Issues using ops with Dart : pthread error: 22 (Invalid argument) #1629

Closed shaselle closed 2 months ago

shaselle commented 3 months ago

Hello! I am currently trying to create a dart server image. Both ops run and ops pkg are failing with a message that I haven't seen previously.

../../runtime/vm/os_thread_linux.cc: 203: error: pthread error: 22 (Invalid argument)

*** signal 6 received by tid 2, errno 0, code -6

*** Thread context:
lastvector: 00000000000000ea
     frame: ffffc00002a01000
      type: thread
active_cpu: 00000000ffffffff
 stack top: 0000000000000000
...

Context

I have run a standalone dart server before as a proof of concept; but its been a while. And as seen in this now resolved dart related issue: Dart has worked well with nano, and ops before.

I seem to be running into the same error message on Ubuntu 24.04 and Debian 12. It does not matter what my app is all about. I have trimmed it down to a helloworld with zero dependencies except the Dart language.

This is happening on all current dart channels, stable, beta, and dev of Dartlang v3.4.4.

Step by step

I have tried this simple dart program: test.dart

void main(final List<String> args){
    print("Hello from NanoVMs.");
}

Then compile test.dart.

dart compile exe test.dart  -o testx

Tried running with a both simple

ops run testx
ops -fn run  testx

I get the following error

../../runtime/vm/os_thread_linux.cc: 203: error: pthread error: 22 (Invalid argument)

*** signal 6 received by tid 2, errno 0, code -6

*** Thread context:
lastvector: 00000000000000ea
     frame: ffffc00002a01000
      type: thread
active_cpu: 00000000ffffffff
 stack top: 0000000000000000
...

Am I missing something?

My system

ops profile

Ops version: 0.1.41
Nanos version: 0.1.50
Qemu version: 8.2.2
OS: linux
Arch: amd64
Virtualized: false

Not that it matters but, the same dart program runs okay on Docker, but I get the same error even with ops pkg fromDocker. The only dart language related error I can see is an old issue that has been fixed and closed, and predates my last working test. runtime/vm/os_thread_linux.cc:234: error: pthread error: 22 (Invalid argument) #24169

francescolavra commented 3 months ago

@shaselle thanks for reporting the issue. Apparently there is a problem with on-demand paging of the program file, and we are working on a fix. In the meantime, you can get going by disabling on-demand paging, i.e. using a configuration file (named e.g. config.json) with the following contents:

{
  "ManifestPassthrough": {
    "static_map_program": "t"
  }
}

and then passing that file to the ops run command by adding -c config.json to your command line.

shaselle commented 3 months ago

@francescolavra thanks for your helpful reply and work towards fixing this issue. Disabling on-demand paging workaround is working as expected. Let me know when you need me to do more testing on my end as soon as the fix is available.

Much appreciated.

francescolavra commented 3 months ago

The on-demand paging issue in solved in https://github.com/nanovms/nanos/pull/2032. If you want to try out the kernel with this fix, you can do it by adding --nanos-version 747cea9 to your ops run command line.

shaselle commented 3 months ago

I can confirm,

running Dart standalone executable with --nanos-version 747cea9, works as expected without disabling on-demand paging.