question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] chia in docker container with non-root user won't start / lock file problem / compile_clvm

See original GitHub issue

What happened?

Environment

  • custom docker image
  • chia 1.3.4 compiled from source
  • pipenv as venv
  • python 3.9.12 (also tested with 3.9.11, 3.9.10)
  • ‘non-root’ user inside docker, chia runs as user 3981

Command inside docker container

chia -h …every chia_* cmd hangs

Current state

deadlock, chia doesn’t show anything.

Expected state

help is shown

Debugging support

  • Stack see below
  • per try-and-error debugging I can say the problem is the custom user in combination with lock file creation of compile_clvm. Maybe the lock file is written to some directory with different permissions. What is this concrete directory?
  • with user root everything works fine
  • until chia 1.3.3 the custom user also worked fine

Version

1.3.4

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

chia@27d9ea5841a5:/app$ chia -h
^CTraceback (most recent call last):
  File "/opt/chia-blockchain/.venv/bin/chia", line 5, in <module>
    from chia.cmds.chia import main
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/cmds/chia.py", line 18, in <module>
    from chia.cmds.plotters import plotters_cmd
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/cmds/plotters.py", line 2, in <module>
    from chia.plotters.plotters import call_plotters
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/plotters/plotters.py", line 5, in <module>
    from chia.plotters.bladebit import get_bladebit_install_info, plot_bladebit
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/plotters/bladebit.py", line 10, in <module>
    from chia.plotting.create_plots import resolve_plot_keys
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/plotting/create_plots.py", line 10, in <module>
    from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/daemon/keychain_proxy.py", line 5, in <module>
    from chia.cmds.init_funcs import check_keys
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/cmds/init_funcs.py", line 10, in <module>
    from chia.consensus.coinbase import create_puzzlehash_for_pk
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/consensus/coinbase.py", line 6, in <module>
    from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py", line 68, in <module>
    from .p2_conditions import puzzle_for_conditions
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/wallet/puzzles/p2_conditions.py", line 17, in <module>
    MOD = load_clvm("p2_conditions.clvm")
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/wallet/puzzles/load_clvm.py", line 106, in load_clvm
    return Program.from_bytes(bytes(load_serialized_clvm(clvm_filename, package_or_requirement=package_or_requirement)))
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/wallet/puzzles/load_clvm.py", line 92, in load_serialized_clvm
    compile_clvm(full_path, output, search_paths=[full_path.parent])
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/wallet/puzzles/load_clvm.py", line 73, in compile_clvm
    with_lock(f"{full_path}.lock", do_compile)
  File "/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/util/lock.py", line 39, in with_lock
    time.sleep(0.1)
KeyboardInterrupt

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
stefan-langecommented, Apr 22, 2022

the reason seems to be that the clvm compile logic wants to create a *.lock file in

/opt/chia-blockchain/.venv/lib/python3.9/site-packages/chia/wallet/puzzles

fixed it for me with this, which is not 100% future proof. That changes the owner of the code directory to the current user, so it can be written to:

RUN find /opt/chia-blockchain/.venv/ -type d -name "puzzles" -exec chown $UID {} \;

I don’t understand exactly why this is done, because in the folder there are already *.clvm and the related *.clvm.hex files - in my case. I think it is not really nice, because the app code can be changed during execution. My intention was to secure the app so no one can change it.

Suggestion: if you need temp or cache files, why not using the existing folders like ~/.cache etc. for that? There should be version for every OS.

2reactions
wallentxcommented, Jul 28, 2022

We are working on this at the moment (https://github.com/Chia-Network/chia-blockchain/pull/12050 is part of it), but for the moment, this workaround seems to be the advisable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow running of non-root user in Docker Container during CI ...
Problem to solve. Right now when Gitlab starts up a container to be used in the CI/CD pipeline, it is always started as...
Read more >
Clang crashes with internal compiler error when ... - Mailing Lists
[llvm-bugs] [Bug 26586] New: Clang crashes with internal compiler error when compiling a simple program with templates.
Read more >
docker compile Code Example - Code Grepper
Failed to start mongod.service: Unit mongod.service not found. ... ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because ...
Read more >
Bug List - FreeBSD Bugzilla
262555, Ports & Packages, Individual Port(s), ports-bugs, New, ---, Build ... www/firefox 72 and newer fail with channel errors at startup, 2021-10-01.
Read more >
Mesa 22.2.0 Release Notes / 2022-09-21
Alien Isolation segfaulting in radeonsi_dri.so starting with Mesa 22.1.0 ... Clang 14 issues compiling src/util/u_cpu_detect.c.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found