Bug #20471
openProblem creating a file on a windows share and copy it afterwards
Description
Hi,
in my Rails application I have the requirement to create a file and copy it to another place on the same windows share. But if I write the file with File
class and try to copy it with FileUtils.cp
it hangs indefinitely without any error message. I can't even kill the ruby process.
You can easily reproduce the bug by entering this in IRB:
filename = "/mnt/windows_share/abc"; File.open(filename, 'wb') { |f| f.write("123" * 1000) }; FileUtils.cp(filename, filename + "d")
I tested this on a Ubuntu 22.04 server in the AWS cloud.
I also tried f.fsync
, f.fdatasync
, f.flush
, but it didn't help.
Probably it's a problem in connection with the cifs-utils
package. The negotiated SMB protocol version for the mount is 3.1.1
.
Please come back to me if you need further information.
Regards!
Ben
EDIT:
I tried mounting the same windows share on my local Ubuntu 22 and the same example works. Even with the same ruby version. So maybe the problem is rather connected to the special AWS Ubuntu kernel. Hard to tell...
Updated by nobu (Nobuyoshi Nakada) 8 months ago
budiljak (Benjamin Udiljak) wrote:
I also tried
f.fsync
,f.fdatasync
,f.flush
, but it didn't help.
Have you tried sleep 1
(or more seconds) after the File.open
block?
Updated by budiljak (Benjamin Udiljak) 8 months ago
nobu (Nobuyoshi Nakada) wrote in #note-1:
budiljak (Benjamin Udiljak) wrote:
I also tried
f.fsync
,f.fdatasync
,f.flush
, but it didn't help.Have you tried
sleep 1
(or more seconds) after theFile.open
block?
Yes. I even tried 5 seconds, but it didn't help neither.