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

Node segfault (error 139) in container release v11.x.x #697

Closed
1 task done
uberDoward opened this issue May 26, 2023 · 51 comments
Closed
1 task done

Node segfault (error 139) in container release v11.x.x #697

uberDoward opened this issue May 26, 2023 · 51 comments

Comments

@uberDoward
Copy link

uberDoward commented May 26, 2023

Bug description

I can neither migrate old data nor can I start a new world. I always get the same error:

{"code":"ECOMPROMISED","errno":-2,"level":"error","message":"ENOENT: no such file or directory, stat '/data/Config/options.json.lock'","path":"/data/Config/options.json.lock","stack":"Error: ENOENT: no such file or directory, stat '/data/Config/options.json.lock'","syscall":"stat","timestamp":"2023-05-26 17:39:43"}
{"level":"error","message":"A fatal error occurred while trying to start the Foundry Virtual Tabletop server: Foundry VTT cannot start in this directory which is already locked by another process.","stack":"Error: A fatal error occurred while trying to start the Foundry Virtual Tabletop server: Foundry VTT cannot start in this directory which is already locked by another process.\n    at _acquireLockFile (file:///home/foundry/resources/app/dist/init.mjs:1:4799)\n    at async _initializeCriticalFunctions (file:///home/foundry/resources/app/dist/init.mjs:1:2593)\n    at async Module.initialize (file:///home/foundry/resources/app/dist/init.mjs:1:1564)","timestamp":"2023-05-26 17:41:11"}
{"level":"error","message":"A fatal error occurred while trying to start the Foundry Virtual Tabletop server: Foundry VTT cannot start in this directory which is already locked by another process.","stack":"Error: A fatal error occurred while trying to start the Foundry Virtual Tabletop server: Foundry VTT cannot start in this directory which is already locked by another process.\n    at _acquireLockFile (file:///home/foundry/resources/app/dist/init.mjs:1:4799)\n    at async _initializeCriticalFunctions (file:///home/foundry/resources/app/dist/init.mjs:1:2593)\n    at async Module.initialize (file:///home/foundry/resources/app/dist/init.mjs:1:1564)","timestamp":"2023-05-26 17:44:36"}

The data is stored on the host system as a bind volume under a directory. All was well with V10.

I attempted to 'reset' all the data as well, by stopping the container, moving the data to a new folder, re-creating the old folder completely empty, and creating a brand new world. The error logs above are from that last attempt.

I have tried removing the options.json.lock directory (isn't this supposed to be a file, not a directory, btw?), recycling the container, to no avail. I suspect this may be a bug in foundry itself, but I'm not certain, and figured anyone else running into this issue from this container may find their way here...

Steps to reproduce

  1. Start a new container instance with a bind volume to hold the container data
  2. Create a new world
  3. Attempt to launch the world

Expected behavior

I expect the world to launch without error.

Container metadata

com.foundryvtt.version = "11.299"
org.opencontainers.image.authors = "markf+github@geekpad.com"
org.opencontainers.image.created = "2023-05-26T01:33:20.124Z"
org.opencontainers.image.description = "An easy-to-deploy Dockerized Foundry Virtual Tabletop server."
org.opencontainers.image.licenses = "MIT"
org.opencontainers.image.revision = "349bc278fa92049dd2b480b322fc30a0842221fb"
org.opencontainers.image.source = "https://github.com/felddy/foundryvtt-docker"
org.opencontainers.image.title = "foundryvtt-docker"
org.opencontainers.image.url = "https://github.com/felddy/foundryvtt-docker"
org.opencontainers.image.vendor = "Geekpad"
org.opencontainers.image.version = "11.299.0"

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@felddy
Copy link
Owner

felddy commented May 26, 2023

Please provide the logs from the container with verbose logging enabled. If you have a docker-compose file that would be helpful as well.

@uberDoward
Copy link
Author

uberDoward commented May 26, 2023

_foundryvtt_logs.txt

Log attached here - note the:

Launcher | 2023-05-26 19:35:31 | [info] Starting Foundry Virtual Tabletop.
FoundryVTT | 2023-05-26 19:35:35 | [info] Running on Node.js - Version 18.16.0
FoundryVTT | 2023-05-26 19:35:35 | [info] Foundry Virtual Tabletop - Version 11 Build 299
FoundryVTT | 2023-05-26 19:35:35 | [info] User Data Directory - "/data"
FoundryVTT | 2023-05-26 19:35:35 | [error] A fatal error occurred while trying to start the Foundry Virtual Tabletop server: Foundry VTT cannot start in this directory which is already locked by another process.
Error: A fatal error occurred while trying to start the Foundry Virtual Tabletop server: Foundry VTT cannot start in this directory which is already locked by another process.
    at _acquireLockFile (file:///home/foundry/resources/app/dist/init.mjs:1:4799)
    at async _initializeCriticalFunctions (file:///home/foundry/resources/app/dist/init.mjs:1:2593)
    at async Module.initialize (file:///home/foundry/resources/app/dist/init.mjs:1:1564)
Launcher | 2023-05-26 19:35:35 | [error] Node process exited with code 1

Corresponds to this:

image

I'm not sure the .lock is meant to be a directory...

@felddy
Copy link
Owner

felddy commented May 26, 2023

Did you report this yesterday by any chance on the FoundryVTT discord? I'm seeing someone with the same error here:

https://discord.com/channels/170995199584108546/486930822465716249/1111373639321911427

The issue most likely not a container bug, as Foundry was installed and successfully launched.

Are you sure there are no other processes / containers running with that same Config directory?

@uberDoward
Copy link
Author

uberDoward commented May 26, 2023

Negative, I'm not on the FoundryVTT server - I'd be uberDoward on there as well, though...

This folder is dedicated to only FoundryVTT data, and this is the only container with access to that folder :)

edit - Opened foundryvtt/foundryvtt#9482 as well. I do agree this is likely an internal bug to FoundryVTT, but I wanted to check in here, first.

@felddy
Copy link
Owner

felddy commented May 26, 2023

Ok then if that's not you... good news then if you believe that miserly loves company.

CaydenSworn#3518 is reporting the same issue in the #troubleshooting forum. I'd keep an eye any resolutions they report.

I saw your issue that you opened to the foundryvtt project. Just be aware that there is a very strong container phobia with the support team. To the point that they will refuse to support any containerized foundry debugging. 🤷

I can't think of any solutions or tests that you haven't already run. Can you think of anything novel about your setup or configuration?

@uberDoward
Copy link
Author

Nothing novel, beyond the basic binding of the volume for the host storage. I'll see if they reply, and I'll go ahead and see if I can re-create it outside the containerization just to quell that discussion ahead of time... Appreciate the heads up!

@uberDoward
Copy link
Author

uberDoward commented May 27, 2023

Ok, so noticed something potentially of interest. Node's dying with exit code 139 (SIGSEGV) - and when I went to launch using the same data config from the straight node FoundryVTT install, all worked fine. As part of trying to get it to run, though, I had to get GCC 3.4.29 - and since I'm running on Bullseye (Raspian) I had to upgrade to unstable (Bookworm) - then I could run FoundryVTT from node non-containerized perfectly fine. What GLIBCXX is available within the container? I'm trying to hit it with /bin/sh so I can check, but now that I migrated the default world, I'm just spinning and crashing the container lol. I'll keep digging...

Edit - Here's the actual log where I go to start the world (now post-migration):

FoundryVTT | 2023-05-27 02:44:37 | [warn] The module "gm-screen" contains "dependencies" which is deprecated in favor of "relationships.requires"
Deprecated since Version 10
Backwards-compatible support will be removed in Version 13
Segmentation fault (core dumped)
Launcher | 2023-05-27 02:44:37 | [error] Node process exited with code 139

Entrypoint | 2023-05-27 02:44:39 | [debug] Timezone set to: UTC
Entrypoint | 2023-05-27 02:44:39 | [info] Starting felddy/foundryvtt container v11.299.0
Entrypoint | 2023-05-27 02:44:39 | [debug] CONTAINER_VERBOSE set.  Debug logging enabled.

BTW, can I get an invite to the discord channel?

Edit Part Deux - My concentration on the lock file was just a symptom. What's happening here, is that upon launch of a world, Node is crashing with exit code 139 (SIGSEGV), then the container restarts. Upon startup, the lock file still exists from the prior crash and that is what I was seeing originally. So the "digging" really needs to be understanding the first 139 exit code from Node...

Note - Node 18.16.0 is what I used from the non-containerized test, and that matches what's claimed in the container as well. Really thinking this may be a glibc issue...

@uberDoward
Copy link
Author

Attach latest log - created a completely fresh image. Running on a raspberry pi4, btw - so this is ARM, rather than x86 based. Completely new container won't launch any world when running in a container, but works fine running directly from my RPi4 host. I'm really leaning towards a container issue
_foundryvtt-test_logs.txt
:(

@Snogard
Copy link

Snogard commented Jun 2, 2023

do you have any issues installing/updating modules too?
i always get a timeout if i try to do that.

@felddy
Copy link
Owner

felddy commented Jun 2, 2023

BTW, can I get an invite to the discord channel?

Click New Issue button on this repo above and it will take you to a page with the Discord invite link.

@felddy
Copy link
Owner

felddy commented Jun 2, 2023

FWIW Here is the info for the two machines I normally run Foundry on:

➤ uname -a 
Linux 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux

➤ cat /etc/issue.net 
Debian GNU/Linux 11

➤ grep Model /proc/cpuinfo 
Model		: Raspberry Pi 4 Model B Rev 1.4
➤ uname -a 
Darwin 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64

➤ sw_vers
ProductName:		macOS
ProductVersion:		13.4
BuildVersion:		22F66

➤ sysctl -n machdep.cpu.brand_string
Apple M1 Ultra

And all continuous integration tests are run on amd64 Ubuntu 22.04.2:

@felddy felddy changed the title Unable to start any world since v11 Node segfault (error 139) in container release v11.299.0 Jun 4, 2023
@felddy
Copy link
Owner

felddy commented Jun 4, 2023

I haven't been able to reproduce this yet. I do have a few ideas that could help diagnose the cause.

  1. Can you try pulling a :nightly build of the container to see if the issue still persists. I'm trying to rule out it being an issue in specific base node image that was used for the release. To do this, set the tag you are pulling to :nightly . https://github.com/felddy/foundryvtt-docker/pkgs/container/foundryvtt/98592774?tag=nightly

  2. Release v11.299.0 is based off of the official node container 18-alpine3.17. Can you try starting that base container and seeing if it is possible to generate a segfault by creating some disk and memory access in node?

Something like this:

docker run --rm -it node:18-alpine3.18 /bin/sh
cd /tmp

npm install diskdb

cat <<EOF > test.js
const db = require('diskdb');
db.connect('/tmp', ['test']);

const data = [];
for(let i = 0; i < 1000000; i++) {
    data.push({ number: i });
}

db.test.save(data);

console.log(db.test.find());
EOF

node test.js
cat <<EOF > test-memory.js
let array = [];

setInterval(() => {
  for(let i = 0; i < 1000000; i++) {
    array.push("This is some text.");
  }

  const memoryUsage = process.memoryUsage();
  console.log("Memory usage: " + JSON.stringify(memoryUsage, null, 2) + " bytes");
}, 1000);
EOF

node test-memory.js

@felddy
Copy link
Owner

felddy commented Jun 5, 2023

I just published the 11.300.0 release. Usually these aren't significant except the version bump for FoundryVTT, but this release also includes a new version of the base node image. Alpine was bumped from 3.17 to 3.18.

In addition to the previous tests I suggested above, please try pulling 11.300.0 to see if it behaves differently.

See:

@DasOcko
Copy link

DasOcko commented Jun 5, 2023

I regret to inform you, that at least in my instance errorcode 139 persists. even with the newest 11.300.0 release
grafik
Just as in Version 11.299.0 The error appears when launching a world, or trying to migrate one to the newest Version.
The error also persists on a complete clean install of the container via docker-compose.

is there any way i could provide a log from within the container?

@mxvs
Copy link

mxvs commented Jun 6, 2023

I wanted to chime in that I'm having the exact same issue as @DasOcko on my Raspberry Pi 4, with a completely fresh install using 11.300.0. The container crashes with a segmentation fault and exit code 139 when trying to load a just created world.

@felddy I've also tried running the example code above to try and segfault node in the default alpine container using the disk and memory test. The disk test did not fail, but the memory test ended up crashing with this error:


#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804
#
#
#
#FailureMessage Object: 0xfff99724
Trace/breakpoint trap (core dumped)

@felddy
Copy link
Owner

felddy commented Jun 7, 2023

@mxvs That is the "good" outcome of the memory test. It ran out of memory and got a SIGTRAP and not a SIGSEGV. Thanks for running it. This is helpful.

@felddy felddy changed the title Node segfault (error 139) in container release v11.299.0 Node segfault (error 139) in container release v11.x.x Jun 8, 2023
@felddy
Copy link
Owner

felddy commented Jun 8, 2023

I just build a version of the image using Node 16 instead of 18.

When you get a chance please pull felddy/foundryvtt:testing-issue-697 and test.

See:

@mxvs
Copy link

mxvs commented Jun 8, 2023

I just build a version of the image using Node 16 instead of 18.

When you get a chance please pull felddy/foundryvtt:testing-issue-697 and test.

See:

I just ran the modified container and it unfortunately still segfaults as soon as I try to load the world :-(

@felddy
Copy link
Owner

felddy commented Jun 9, 2023

Ok. That gives us more data. Thank you for helping run this down. I wish I could reproduce it myself.

I"ve got another idea. Let's start up the last version of the image that was working, but request Foundry version 11.300 be installed.

So that would mean starting felddy/foundryvtt:10.291.1 and setting the environment variable FOUNDRY_VERSION to 11.300.

Normally this would work fine. You'd just have a mismatch between the container and Foundry which means you might not have access to specifying some options via environment variables. You will see a warning like this in the logs:

foundryvtt-mine-foundry-1  | Entrypoint | 2023-06-08 21:21:10 | [warn] FOUNDRY_VERSION has been manually set and does not match the container's version.
foundryvtt-mine-foundry-1  | Entrypoint | 2023-06-08 21:21:10 | [warn] Expected 10.291 but found 11.300
foundryvtt-mine-foundry-1  | Entrypoint | 2023-06-08 21:21:10 | [warn] The container may not function properly with this version mismatch.

I can confirm that this test works on my side.

If you still see the segfault then we know it's something specific to Foundry v11. Then the debugging fun really begins. ;)

@mxvs
Copy link

mxvs commented Jun 9, 2023

Ok. That gives us more data. Thank you for helping run this down. I wish I could reproduce it myself.

I"ve got another idea. Let's start up the last version of the image that was working, but request Foundry version 11.300 be installed.

So that would mean starting felddy/foundryvtt:10.291.1 and setting the environment variable FOUNDRY_VERSION to 11.300.

Normally this would work fine. You'd just have a mismatch between the container and Foundry which means you might not have access to specifying some options via environment variables. You will see a warning like this in the logs:

foundryvtt-mine-foundry-1  | Entrypoint | 2023-06-08 21:21:10 | [warn] FOUNDRY_VERSION has been manually set and does not match the container's version.
foundryvtt-mine-foundry-1  | Entrypoint | 2023-06-08 21:21:10 | [warn] Expected 10.291 but found 11.300
foundryvtt-mine-foundry-1  | Entrypoint | 2023-06-08 21:21:10 | [warn] The container may not function properly with this version mismatch.

I can confirm that this test works on my side.

If you still see the segfault then we know it's something specific to Foundry v11. Then the debugging fun really begins. ;)

Alright, I just tried the above both with 11.300 in the 10.291.1 container and the just released 11.301 and in both instances the segfault is still thrown when trying to open the world. So its something specific to v11 and not the container..

@felddy
Copy link
Owner

felddy commented Jun 9, 2023

Thanks for testing. I think this is the most telling test results so far.
I've got a couple problems to overcome now:

  1. I need to do some thinking about how to run this down further despite not being able to reproduce it yet.
  2. The FoundryVTT developers are anti-container and do not support containerized installs, or bug reports related to them.

I'll keep working on this. Thank you again for the test help.

@mxvs
Copy link

mxvs commented Jun 10, 2023

Thanks for testing. I think this is the most telling test results so far. I've got a couple problems to overcome now:

  1. I need to do some thinking about how to run this down further despite not being able to reproduce it yet.
  2. The FoundryVTT developers are anti-container and do not support containerized installs, or bug reports related to them.

I'll keep working on this. Thank you again for the test help.

So, to be absolutely certain, I wanted to try running things in a barebones container, install Foundry V11 manually and see if it would still segfault. The short version is that it works just fine this way. This might indicate it might not be a Foundry bug after all, or at least there is some weird interaction going on with the way the container is set-up as I got it to work in another container configuration on the same hardware.

So here is what I did:

  • I pulled the latest official Ubuntu docker image (since I know how to work with that)
  • Ran the image with docker run with just port 30000 mapped and dropping straight into a bash shell, no other options
  • Installed only the following tools: sudo, wget, curl, libssl-dev and installed nodejs 18 using the official install script
  • I then followed the install instructions here https://foundryvtt.com/article/installation/ to the letter and ran Foundry
  • Installed dnd5e system, created a test world and launched it
  • No segfault!

So its definitely possible to run Foundry V11 in a container on a Raspberry PI 4.. not sure if this makes it easier or harder now, but I feel this takes us a step closer to a solution..

@mxvs
Copy link

mxvs commented Jun 12, 2023

@felddy I tried two more things (tell me when to stop):

  • Tried running the same steps as above, but this time with the official Alpine 3.18 container with NodeJS v18 or v20
  • In both cases I get the segmentation fault

So on the Raspberry PI 4 hardware, running Foundry v11 works with an Ubuntu based image but not with Alpine. Is there a way we could get a release of your container setup based on another distro than Alpine for this case or would it be possible for me to modify and build a version myself?

Thanks

@mcdonnnj
Copy link
Contributor

mcdonnnj commented Jun 13, 2023

Follow up:

I dropped into a shell in the container and tried to find where libstdc++ was located because according to apt-get it is installed and I got the following:

root@28d99cd0f12c:/home/foundry# find / -name "libstdc*"
/usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.28
/usr/lib/arm-linux-gnueabihf/libstdc++.so.6
/usr/share/gcc/python/libstdcxx
/usr/share/gdb/auto-load/usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.28-gdb.py
/usr/share/doc/libstdc++6
/var/lib/dpkg/info/libstdc++6:armhf.triggers
/var/lib/dpkg/info/libstdc++6:armhf.md5sums
/var/lib/dpkg/info/libstdc++6:armhf.list
/var/lib/dpkg/info/libstdc++6:armhf.prerm
/var/lib/dpkg/info/libstdc++6:armhf.symbols
/var/lib/dpkg/info/libstdc++6:armhf.shlibs

Do you have a 32-bit version of Raspbian installed on your 64-bit Raspberry Pi? I'm trying to think of why you would be pulling an armhf image instead of an arm64 image.

@uberDoward
Copy link
Author

Hey that's a great point @mcdonnnj - My setup was running 64bit raspbian on 64bit raspberry pi 4 and refused to work.

@mcdonnnj
Copy link
Contributor

Hey that's a great point @mcdonnnj - My setup was running 64bit raspbian on 64bit raspberry pi 4 and refused to work.

@uberDoward Have you tried the image tag that @felddy created for working on this issue (felddy/foundryvtt:testing-issue-697)?

@uberDoward
Copy link
Author

uberDoward commented Jun 13, 2023

@mcdonnnj - not yet. Work has been killing me, and I had a bit of a rough zfs pool migration that JUST finished on the home lab. I've been utterly exhausted and why I haven't participated after I booted FoundryVTT-docker from the ARM64 RPi4 over to the x86 server LOL - I will try to try it tonight, but not making promises*, my wife just went back into the hospital this morning and I'm running the house as well...

@uberDoward
Copy link
Author

uberDoward commented Jun 13, 2023

I gotta cook dinner BUT I am fundamentally incapable of leaving a problem alone. It's a weakness. Here's what I got:

Actions
      
Entrypoint | 2023-06-13 22:49:49 | [info] Starting felddy/foundryvtt container v11.301.0
Entrypoint | 2023-06-13 22:49:49 | [info] No Foundry Virtual Tabletop installation detected.
Entrypoint | 2023-06-13 22:49:49 | [info] Using FOUNDRY_USERNAME and FOUNDRY_PASSWORD to authenticate.
Authenticate | 2023-06-13 22:49:50 | [info] Requesting CSRF tokens from https://foundryvtt.com
Authenticate | 2023-06-13 22:49:51 | [info] Logging in as: uberdoward
Authenticate | 2023-06-13 22:49:52 | [info] Successfully logged in as: uberdoward
Entrypoint | 2023-06-13 22:49:52 | [info] Using authenticated credentials to download release.
ReleaseURL | 2023-06-13 22:49:53 | [info] Fetching S3 pre-signed release URL for build 301...
Entrypoint | 2023-06-13 22:49:54 | [info] Using CONTAINER_CACHE: /data/container_cache
Entrypoint | 2023-06-13 22:49:54 | [info] Downloading Foundry Virtual Tabletop release.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  2  207M    2 6338k    0     0  4868k      0  0:00:43  0:00:01  0:00:42 4864k
 11  207M   11 24.5M    0     0  10.8M      0  0:00:19  0:00:02  0:00:17 10.8M
 21  207M   21 44.6M    0     0  13.6M      0  0:00:15  0:00:03  0:00:12 13.6M
 30  207M   30 63.9M    0     0  15.0M      0  0:00:13  0:00:04  0:00:09 15.0M
 38  207M   38 79.8M    0     0  15.1M      0  0:00:13  0:00:05  0:00:08 15.9M
 46  207M   46 96.4M    0     0  15.3M      0  0:00:13  0:00:06  0:00:07 18.1M
 53  207M   53  110M    0     0  15.2M      0  0:00:13  0:00:07  0:00:06 17.2M
 59  207M   59  123M    0     0  14.9M      0  0:00:13  0:00:08  0:00:05 15.7M
 65  207M   65  135M    0     0  14.6M      0  0:00:14  0:00:09  0:00:05 14.3M
 68  207M   68  142M    0     0  13.9M      0  0:00:14  0:00:10  0:00:04 12.6M
 72  207M   72  150M    0     0  13.3M      0  0:00:15  0:00:11  0:00:04 10.7M
 76  207M   76  157M    0     0  12.8M      0  0:00:16  0:00:12  0:00:04 9683k
 80  207M   80  165M    0     0  12.4M      0  0:00:16  0:00:13  0:00:03 8646k
 83  207M   83  172M    0     0  12.0M      0  0:00:17  0:00:14  0:00:03 7508k
 86  207M   86  178M    0     0  11.7M      0  0:00:17  0:00:15  0:00:02 7330k
 88  207M   88  183M    0     0  11.2M      0  0:00:18  0:00:16  0:00:02 6706k
 91  207M   91  189M    0     0  11.0M      0  0:00:18  0:00:17  0:00:01 6557k
 94  207M   94  196M    0     0  10.7M      0  0:00:19  0:00:18  0:00:01 6347k
 98  207M   98  203M    0     0  10.5M      0  0:00:19  0:00:19 --:--:-- 6412k
100  207M  100  207M    0     0  10.4M      0  0:00:19  0:00:19 --:--:-- 6502k
Entrypoint | 2023-06-13 22:50:14 | [info] Installing Foundry Virtual Tabletop 11.301
Entrypoint | 2023-06-13 22:50:22 | [info] Preserving release archive file in cache.
Entrypoint | 2023-06-13 22:50:22 | [info] Not modifying existing installation license key.
Entrypoint | 2023-06-13 22:50:22 | [info] Setting data directory permissions.
Entrypoint | 2023-06-13 22:50:22 | [info] Starting launcher with uid:gid as foundry:foundry.
Launcher | 2023-06-13 22:50:22 | [info] Generating options.json file.
Launcher | 2023-06-13 22:50:23 | [warn] No 'Admin Access Key' has been configured.
Launcher | 2023-06-13 22:50:23 | [info] Starting Foundry Virtual Tabletop.
node:internal/modules/cjs/loader:1338
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^
Error: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/foundry/resources/app/node_modules/classic-level/prebuilds/linux-arm/node.napi.armv7.node)
    at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at load (/home/foundry/resources/app/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/home/foundry/resources/app/node_modules/classic-level/binding.js:1:43)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  code: 'ERR_DLOPEN_FAILED'
}
Node.js v18.16.0
Launcher | 2023-06-13 22:50:26 | [error] Node process exited with code 1

Using

Image ghcr.io/felddy/foundryvtt:testing-issue-697@sha256:e82ab80e46f40737c8b359931686425ada340cacea0691b3f3b2effc00b024e7

@uberDoward
Copy link
Author

That jives with my gut instinct of this being a GLIBC issue. If I get any free time (HAHAHA), I'll try rebuilding the dependencies from source. My home lab is Gentoo, and my day job is a senior software engineer. I'm familiar with building code, lol

@mxvs
Copy link

mxvs commented Jun 14, 2023

Follow up:
I dropped into a shell in the container and tried to find where libstdc++ was located because according to apt-get it is installed and I got the following:

root@28d99cd0f12c:/home/foundry# find / -name "libstdc*"
/usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.28
/usr/lib/arm-linux-gnueabihf/libstdc++.so.6
/usr/share/gcc/python/libstdcxx
/usr/share/gdb/auto-load/usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.28-gdb.py
/usr/share/doc/libstdc++6
/var/lib/dpkg/info/libstdc++6:armhf.triggers
/var/lib/dpkg/info/libstdc++6:armhf.md5sums
/var/lib/dpkg/info/libstdc++6:armhf.list
/var/lib/dpkg/info/libstdc++6:armhf.prerm
/var/lib/dpkg/info/libstdc++6:armhf.symbols
/var/lib/dpkg/info/libstdc++6:armhf.shlibs

Do you have a 32-bit version of Raspbian installed on your 64-bit Raspberry Pi? I'm trying to think of why you would be pulling an armhf image instead of an arm64 image.

Yes, I'm running the 32 bit OS, when I first set-up the PI4, the 64 bit version was still in beta and even today on their website the 32 bit version is mentioned as "Our recommended operating system for most users."

@felddy
Copy link
Owner

felddy commented Jun 19, 2023

As a workaround for this issue you can try the following:

  1. Create a container_patches directory in your data mount. e.g., data/container_patches.

  2. In this directory create a file called: patch-issue-697.sh with the following contents:

    #!/bin/ash
    
    # Issue 697 Fix
    # =====================
    
    PATCH_DOC_URL="https://github.com/felddy/foundryvtt-docker/issues/697"
    PATCH_NAME="Fix for issue #697"
    
    log "Applying \"${PATCH_NAME}\""
    log "See: ${PATCH_DOC_URL}"
    
    apk add g++ make python3
    cd resources/app
    npm install classic-level --build-from-source
    cd -
  3. Set the environment variable: CONTAINER_PATCHES=/data/container_patches in your container's configuration.

  4. Start the container using the standard release image: felddy/foundryvtt:release

In your container logs you will see lines similar to this after Foundry is installed but before it starts:

...
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Using CONTAINER_PATCHES: /data/container_patches
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Container patches directory detected.  Starting patch application...
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Sourcing patch from file: /data/container_patches/issue-697.sh
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Applying "Fix for issue #697"
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] See: https://github.com/felddy/foundryvtt-docker/issues/697
foundryvtt-foundry-1  | fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/aarch64/APKINDEX.tar.gz
foundryvtt-foundry-1  | fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/aarch64/APKINDEX.tar.gz
foundryvtt-foundry-1  | (1/29) Installing libstdc++-dev (12.2.1_git20220924-r10)
foundryvtt-foundry-1  | (2/29) Installing zstd-libs (1.5.5-r4)
foundryvtt-foundry-1  | (3/29) Installing binutils (2.40-r7)
foundryvtt-foundry-1  | (4/29) Installing libgomp (12.2.1_git20220924-r10)
foundryvtt-foundry-1  | (5/29) Installing libatomic (12.2.1_git20220924-r10)
...
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:52:11 | [info] Completed file patching.
...

This should apply the steps as documented in the associated issue here:

Please let me know how this works. If it succeeds I can add this file to the repo's patch library for others to use.

@mxvs
Copy link

mxvs commented Jun 20, 2023

As a workaround for this issue you can try the following:

  1. Create a container_patches directory in your data mount. e.g., data/container_patches.
  2. In this directory create a file called: patch-issue-697.sh with the following contents:
    #!/bin/ash
    
    # Issue 697 Fix
    # =====================
    
    PATCH_DOC_URL="https://github.com/felddy/foundryvtt-docker/issues/697"
    PATCH_NAME="Fix for issue #697"
    
    log "Applying \"${PATCH_NAME}\""
    log "See: ${PATCH_DOC_URL}"
    
    apk add g++ make python3
    cd resources/app
    npm install classic-level --build-from-source
    cd -
  3. Set the environment variable: CONTAINER_PATCHES=/data/container_patches in your container's configuration.
  4. Start the container.

In your container logs you will see lines similar to this after Foundry is installed but before it starts:

...
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Using CONTAINER_PATCHES: /data/container_patches
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Container patches directory detected.  Starting patch application...
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Sourcing patch from file: /data/container_patches/issue-697.sh
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] Applying "Fix for issue #697"
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:51:50 | [info] See: https://github.com/felddy/foundryvtt-docker/issues/697
foundryvtt-foundry-1  | fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/aarch64/APKINDEX.tar.gz
foundryvtt-foundry-1  | fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/aarch64/APKINDEX.tar.gz
foundryvtt-foundry-1  | (1/29) Installing libstdc++-dev (12.2.1_git20220924-r10)
foundryvtt-foundry-1  | (2/29) Installing zstd-libs (1.5.5-r4)
foundryvtt-foundry-1  | (3/29) Installing binutils (2.40-r7)
foundryvtt-foundry-1  | (4/29) Installing libgomp (12.2.1_git20220924-r10)
foundryvtt-foundry-1  | (5/29) Installing libatomic (12.2.1_git20220924-r10)
...
foundryvtt-foundry-1  | Entrypoint | 2023-06-19 17:52:11 | [info] Completed file patching.
...

This should apply the steps as documented in the associated issue here:

Please let me know how this works. If it succeeds I can add this file to the repo's patch library for others to use.

It doesn't run, you get:

/data/container_patches/patch-issue-697.sh: line 12: apk: command not found

I think its because the container behind felddy/foundryvtt:testing-issue-697 is now the debain based build you prepared in this comment (#697 (comment)) and no longer the alpine version that has apk as the package manager?

@felddy
Copy link
Owner

felddy commented Jun 20, 2023

It doesn't run, you get:

/data/container_patches/patch-issue-697.sh: line 12: apk: command not found

I think its because the container behind felddy/foundryvtt:testing-issue-697 is now the debain based build you prepared in this comment (#697 (comment)) and no longer the alpine version that has apk as the package manager?

Sorry I wasn't clear. You should use the standard releases. e.g., felddy/foundryvtt:release

@ChunkLightTuna
Copy link

ChunkLightTuna commented Jun 20, 2023

Please let me know how this works. If it succeeds I can add this file to the repo's patch library for others to use.

This fixed the segfault I was getting on a pi4, thank you!

(to be clear, I applied the changes to alpine, not the debian branch.)

@mxvs
Copy link

mxvs commented Jun 20, 2023

Please let me know how this works. If it succeeds I can add this file to the repo's patch library for others to use.

I too can confirm that this works on my Raspberry Pi 4 and solves the segfault 🥳 I will note that this increases the startup time of the container to a little over two minutes on the Pi 4 hardware due to the compilation step, perhaps a useful disclaimer to mention when publishing the patch.

Thanks for all the efforts to resolve this issue!

@github-actions
Copy link

This issue has been automatically marked as stale because it has been inactive for 28 days. To reactivate the issue, simply post a comment with the requested information to help us diagnose this issue. If this issue remains inactive for another 7 days, it will be automatically closed.

@uberDoward
Copy link
Author

Apologies for the delayed response - I'll test as well this weekend on my rpi4

@EtienneLamoureux
Copy link

EtienneLamoureux commented Aug 4, 2023

I was having this problem and your solution worked for my system.

Problem

When upgrading or launching a world, foundry crashed with the follow logs:

Segmentation fault (core dumped)
Launcher | 2023-05-27 02:44:37 | [error] Node process exited with code 139

Solution

Exactly as described here: #697 (comment)

My system

$ uname -a
Linux raspberrypi 5.15.84-v7l+ #1613 SMP Thu Jan 5 12:01:26 GMT 2023 armv7l GNU/Linux
$ cat /etc/issue.net
Raspbian GNU/Linux 11
$ grep Model /proc/cpuinfo
Model           : Raspberry Pi 4 Model B Rev 1.5

@Skel-Enkai
Copy link

I was having this problem and your solution worked for my system.

Problem

When upgrading or launching a world, foundry crashed with the follow logs:

Segmentation fault (core dumped)
Launcher | 2023-05-27 02:44:37 | [error] Node process exited with code 139

Solution

Exactly as described here: #697 (comment)

My system

$ uname -a
Linux raspberrypi 5.15.84-v7l+ #1613 SMP Thu Jan 5 12:01:26 GMT 2023 armv7l GNU/Linux
$ cat /etc/issue.net
Raspbian GNU/Linux 11
$ grep Model /proc/cpuinfo
Model           : Raspberry Pi 4 Model B Rev 1.5

Exact same issue for me, except here was my System:

$ uname -a
Linux DietPi 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
$ cat /etc/issue.net
Debian GNU/Linux 12
$ grep Model /proc/cpuinfo
Model           : Raspberry Pi 2 Model B Rev 1.1

Thank you @felddy!

@github-actions
Copy link

This issue has been automatically marked as stale because it has been inactive for 28 days. To reactivate the issue, simply post a comment with the requested information to help us diagnose this issue. If this issue remains inactive for another 7 days, it will be automatically closed.

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

This issue has been automatically closed due to inactivity. If you are still experiencing problems, please open a new issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
felddy added a commit that referenced this issue Mar 15, 2024
Add hotfix for issue #697 - v11 database glibc workaround
@felddy
Copy link
Owner

felddy commented Mar 15, 2024

I'd added a patch file for this issue. This allows you to specify the patch using an environment variable instead of creating a patch file manually.

See:

e.g.;

---
version: "3.8"

services:
  foundry:
    image: felddy/foundryvtt:release
    hostname: my_foundry_host
    volumes:
      - type: bind
        source: <your_data_dir>
        target: /data
    environment:
      - CONTAINER_PATCH_URLS=
        https://raw.githubusercontent.com/felddy/foundryvtt-docker/develop/patches/hotfix_issue_697.sh
      - FOUNDRY_PASSWORD=<your_password>
      - FOUNDRY_USERNAME=<your_username>
      - FOUNDRY_ADMIN_KEY=atropos
    ports:
      - target: 30000
        published: 30000
        protocol: tcp

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

No branches or pull requests

9 participants