Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@maierru
Copy link
Contributor

@maierru maierru commented Jan 3, 2022

when using shared tmp dir inside parallel docker containers (same Process id)
you can see errors like below

const_generator.rb:136:in ``': Text file busy - /tmp/rb_const_gen_bin_1 (Errno::ETXTBSY)
const_generator.rb:137:in `unlink': No such file or directory @ apply2files - /tmp/rb_const_gen_bin_1 (Errno::ENOENT)

@larskanis
Copy link
Member

Can't we use Tempfile for this job like so (or similar):

Tempfile.open("#{@prefix}.rb_const_gen_bin") do |bf|
  binary = bf.path
  [...]

@maierru
Copy link
Contributor Author

maierru commented Jan 4, 2022

Can't we use Tempfile for this job like so (or similar):

Tempfile.open("#{@prefix}.rb_const_gen_bin") do |bf|
  binary = bf.path
  [...]

thanks for quick response!

As I understood, we need two files - one for generated c source code and another for binary (which is created by gcc)
first one used as you suggested
https://github.com/ffi/ffi/pull/929/files#diff-4756902fc04469bc839933537bb1bda3bbc1260617e86e215a587bfba0873bcdR128
but main assumption here, that no one is going to create same binary at the end of compilation (because of different process id), but inside docker you start with the process pid 1 and if you share tmp directory that leads to errors :(

@maierru
Copy link
Contributor Author

maierru commented Jan 4, 2022

Can't we use Tempfile for this job like so (or similar):

Tempfile.open("#{@prefix}.rb_const_gen_bin") do |bf|
  binary = bf.path
  [...]

maybe I misunderstood you, I did it in a different way, wdyt?

@larskanis larskanis merged commit c438e36 into ffi:master Jan 4, 2022
@larskanis
Copy link
Member

This looks good. Thank you!

@maierru maierru deleted the fix/shared_tmp_inside_docker branch January 4, 2022 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants