Skip to content

Error deleting file *.lock #8

Closed

Description

@NIFR91

Description

I want to process some text stream with my program (the same program) as in :

echo "hello\nworld\n" | ./myprog.cr  process-lines | ./myprog.cr  process-columns

When using the crystal compiler like in #! usr/bin/env crystal I got an error so following a issue
I found crun. From the description I think it should handle my case but when using it
I found the following error :

Unhandled exception: Error deleting file '/home/ nieto/.cache/crun/writter.crystal.lock': No such file or directory (Errno)
Failed to raise an exception: END_OF_STACK
[0x55c92d246da6] ???
[0x55c92d201afb] __crystal_raise +43
[0x55c92d202af5] ???
[0x55c92d20b131] ???
[0x55c92d2067ac] ???
[0x55c92d205bff] ???
[0x55c92d21f46d] ???
[0x55c92d21d9a5] ???
[0x55c92d20429a] main +74
[0x7f8f791e309b] __libc_start_main +235
[0x55c92d20087a] _start +42
[0x0] ???
minimal program
#!/usr/bin/env crun

while line = gets 
  puts line
end 

or

#!/usr/bin/env crun 
sleep 1

Activity

  1. Val commented on Nov 4, 2019

    @Val
    Owner
  2. added
    bug
    on Nov 4, 2019
  3. bew commented on Nov 4, 2019

    @bew
    Contributor

    Yes @Val but iirc the lock file is generated by crun in this case, no?

  4. Val commented on Nov 5, 2019

    @Val
    Owner

    This issue is very interesting and reveal some race conditions

    1. File.delete(lockfile.path)
      with a possible workarround
    2. crun/src/shards.cr

      Lines 22 to 31 in 94c7c85

      File.open(shards_config_path, "w") do |file|
      file.puts <<-EOYAML
      ---
      name: #{SOURCE_FILENAME}
      version: 0.1.0
      dependencies:
      #{shards_yaml}
      ...
      EOYAML
      end
      with another possible workarround

    But I added some pipe samples specifications and it still fail, see lock_deletion_race_condition_fix branch. And some times you get an error like for crystal-lang/crystal#8075 or crystal-lang/crystal#7810

    > make tests
    crystal tool format -i src -i spec
    crun format passed
    rm -f crun crun.sha256
    crun clean passed
    crystal build src/main.cr -o crun --warnings all --error-on-warnings --error-trace
    crun build passed
    crystal spec --debug --warnings all --error-on-warnings --error-trace
    .....error:
    Failed to raise an exception: END_OF_STACK
    [0x56511fbb0e76] *CallStack::print_backtrace:Int32 +118
    [0x56511fb93006] __crystal_raise +86
    [0x56511fb9352e] ???
    [0x56511fbe0966] *Crystal::System::File::open<String, String, File::Permissions>:Int32 +214
    [0x56511fbd9c83] *File::new<String, String, File::Permissions, Nil, Nil>:File +67
    [0x56511fba7b1d] *CallStack::read_dwarf_sections:(Array(Tuple(UInt64, UInt64, String)) | Nil) +109
    [0x56511fba78ad] *CallStack::decode_line_number<UInt64>:Tuple(String, Int32, Int32) +45
    [0x56511fba7038] *CallStack#decode_backtrace:Array(String) +296
    [0x56511fba6ef2] *CallStack#printable_backtrace:Array(String) +50
    [0x56511fc1560d] *Exception+ +77
    [0x56511fc15458] *Exception+ +120
    [0x56511fc115da] *AtExitHandlers::run<Int32>:Int32 +490
    [0x56511fc514ab] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +139
    [0x56511fb9da16] main +6
    [0x7f988572d09b] __libc_start_main +235
    [0x56511fb9188a] _start +42
    [0x0] ???
    Crun::BuildError: Build failed: crystal build --debug --error-on-warnings --error-trace -o /tmp/.lgmAAIcrun_spec_local_cache/foo__path_to_crystal_crun_spec_samples_pipe_echo_cr/echo.cr.crystal /path/to/crun/spec/samples/pipe/echo.cr
    
    STDOUT:
    
    
    STDERR:
    In /path/to/crun/spec/samples/pipe/echo.cr:1:1
    
     1 | while line = gets
         ^
    Error: can't find file 'prelude'
    
    If you're trying to require a shard:
    - Did you remember to run `shards install`?
    - Did you make sure you're running the compiler in the same directory as your shard.yml?
  5. added
    help wanted
    on Nov 5, 2019
  6. added a commit that references this issue on Apr 6, 2021
    e31830b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions