Project

General

Profile

Actions

Bug #20471

open

Problem creating a file on a windows share and copy it afterwards

Added by budiljak (Benjamin Udiljak) 25 days ago. Updated 14 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:117774]

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) 25 days 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) 24 days 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 the File.open block?

Yes. I even tried 5 seconds, but it didn't help neither.

Actions #3

Updated by budiljak (Benjamin Udiljak) 23 days ago

  • Description updated (diff)
Actions #4

Updated by budiljak (Benjamin Udiljak) 14 days ago

  • Description updated (diff)
Actions #5

Updated by budiljak (Benjamin Udiljak) 14 days ago

  • ruby -v set to 3.1.2p20
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0