Bug 1424492

Summary: IOException during "File.WriteAllText" to the file under NFS on Linux
Product: dotNET Reporter: Rick Wagner <rwagner>
Component: rh-dotnetcore10Assignee: Omair Majid <omajid>
Status: CLOSED ERRATA QA Contact: jiri vanek <jvanek>
Severity: medium Docs Contact: Les Williams <lwilliam>
Priority: unspecified    
Version: 1.0CC: bgollahe, byount, dbhole, kanderso, lzachar, rwagner
Target Milestone: ga   
Target Release: 1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rh-dotnetcore10-dotnetcore-1.0.4-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-15 08:37:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rick Wagner 2017-02-17 17:18:57 UTC
Description of problem:
As described in the dotnet community tracker at [1], file writes to an NSF drive fail.  

[1] https://github.com/dotnet/corefx/issues/16256

Comment 1 Omair Majid 2017-02-21 14:30:40 UTC
GSS confirmed the corefx patch indeed fixes the problem:

https://github.com/dotnet/corefx/commit/60d1b3d22eca28ca3dfe375d0cefd2bd16059261

Comment 3 jiri vanek 2017-03-14 12:50:38 UTC
[tester@rhel7-x64 hello-world2]$ cat Program.cs  || [tester@rhel7-x64 hello-world]$ cat Program.cs 

using System;
using System.IO;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
File.WriteAllText(@"/mnt/nfs_share/tetest.txt", "TextToWrite");
            Console.WriteLine("Hello World!");
        }
    }
}


[tester@rhel7-x64 hello-world2]$ rpm -qa | grep dotnet
rh-dotnetcore10-dotnetcore-1.0.3-3.el7.x86_64
rh-dotnetcore10-runtime-1.0-4.el7.x86_64
rh-dotnetcore10-libuv-1.9.0-1.el7.x86_64
rh-dotnetcore10-1.0-4.el7.x86_64
rh-dotnetcore10-libcurl-7.47.1-4.el7.x86_64

[tester@rhel7-x64 hello-world2]$ scl enable rh-dotnetcore10 -- dotnet run
Project hello-world2 (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling hello-world2 for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:00.8768346
 

Hello World!

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '/mnt/nfs_share/tetest.txt' is denied. ---> System.IO.IOException: Bad file descriptor
   --- End of inner exception stack trace ---
   at System.IO.UnixFileStream.CheckFileCall(Int64 result, Boolean ignoreNotSupported)
   at System.IO.UnixFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
   at System.IO.UnixFileSystem.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding)
   at System.IO.File.WriteAllText(String path, String contents)
   at ConsoleApplication.Program.Main(String[] args)




[tester@rhel7-x64 ~]$ rpm -qa | grep dotnet
rh-dotnetcore10-1.0-4.el7.x86_64
rh-dotnetcore10-libuv-1.9.0-1.el7.x86_64
rh-dotnetcore10-dotnetcore-1.0.4-1.el7.x86_64
rh-dotnetcore10-runtime-1.0-4.el7.x86_64
rh-dotnetcore10-libcurl-7.47.1-4.el7.x86_64
[tester@rhel7-x64 ~]$ scl enable rh-dotnetcore10 -- dotnet --version
1.0.0-preview2-003157


[tester@rhel7-x64 hello-world]$ scl enable rh-dotnetcore10 -- dotnet run
Project hello-world (.NETCoreApp,Version=v1.0) will be compiled because inputs were modified
Compiling hello-world for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:00.8816610
 

Hello World!
Hello World!





Where /mnt/nfs_share/ is:

[tester@rhel7-x64 hello-world2]$ df -h
Filesystem             Size  Used Avail Use% Mounted on
...
tmpfs                  1.0G  4.0K  1.0G   1% /mnt/export
localhost:/mnt/export  1.0G     0  1.0G   0% /mnt/nfs_share

[tester@rhel7-x64 hello-world2]$ cat /etc/exports
/mnt/export *(fsid=25,rw,sync)

and mnt/export is mount --bind ramdisk at /mnt/rmadisk2  accessible as 777:

-rw-rw-r-- 1 tester tester 5 Mar 14 12:32 aaa
-rwxrw-r-- 1 tester tester 0 Mar 14 12:42 tetest.txt
[tester@rhel7-x64 hello-world2]$ ll /mnt/nfs_share/
total 4
-rw-rw-r-- 1 tester tester 5 Mar 14 12:32 aaa
-rwxrw-r-- 1 tester tester 0 Mar 14 12:42 tetest.txt
[tester@rhel7-x64 hello-world2]$ ll /mnt/ramdisk2/
total 4
-rw-rw-r-- 1 tester tester 5 Mar 14 12:32 aaa
-rwxrw-r-- 1 tester tester 0 Mar 14 12:42 tetest.txt


[tester@rhel7-x64 hello-world2]$ ll /mnt
total 0
drwxrwxrwt 2 root   root  80 Mar 14 12:42 export
drwxrwxrwt 2 root   root  80 Mar 14 12:42 nfs_share
drwxrwxrwt 2 root   root  80 Mar 14 12:42 ramdisk2

Comment 5 errata-xmlrpc 2017-03-15 08:37:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0519.html