You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't run Flutter on NFS (flock reports "Bad file descriptor") #6549
I expect you may have difficulty reproducing this, but I run into the following error when running flutter:
$ flutter
flock: 3: Bad file descriptor
The error happens at line 35 of the flutter shell script, which tries to take a lock using the flock utility. This is on a debian stable computer, and I have no experience using flock with bash, and haven't been able to debug it. I can make flutter work fine by changing the preceding line such that the if statement fails and a lock is not taken.
I presume file descriptor 3 is supposed to be created by line 50, which reads:
) 3< $PROG_NAME
but don't care to learn enough bash to figure out why it is not working, particularly as I have a workaround. But it does seem worth fixing, to make flutter work for folks who aren't comfortable editing a bash script.
Logs
Can't do this since flutter fails. Unless I disable the lock, in which case it works fine.
$ bash --version
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Can you add the indicated line below to your flutter shell script in the indicated position and tell me everything that prints when you run flutter doctor?
...
(
ifhash flock 2>/dev/null;then
stat "$PROG_NAME"# ADD THIS LINE
flock 3 # ensures that we don't simultaneously update Dart in multiple parallel instances# some platforms (e.g. Mac) don't have flock or any reliable alternativefi
...
$ bash --version
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
On Wed, Oct 26, 2016 at 8:29 PM Ian Hickson [email protected]
wrote:
It just occurred to me that this is in an NFS-mounted directory, and I know NFS has some differences in locking. Flutter works fine in /tmp, which is tmpfs. So I guess maybe you can somehow identify that NFS is in use and avoid flock in that case?
Any chance that a fix for this could go in, so I could use flutter in my home directory over nfs? My current fix is to edit bin/flutter to change 'if hash flock...' to have a misspelling in flock, so that it doesn't use flock, which fails on nfs. I'm not sure what a proper fix would be, not being an expert in the use of flock.
The problem seems to be that NFS doesn't support exclusive locking on a file descriptor opened in read-only mode, because it wants to write in order to lock the file.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
abarth commentedon Oct 27, 2016
@Hixie
Hixie commentedon Oct 27, 2016
What version of bash?
droundy commentedon Oct 27, 2016
$ bash --version
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Hixie commentedon Oct 27, 2016
Can you add the indicated line below to your flutter shell script in the indicated position and tell me everything that prints when you run
flutter doctor?droundy commentedon Oct 27, 2016
$ bash --version
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
On Wed, Oct 26, 2016 at 8:29 PM Ian Hickson [email protected]
wrote:
droundy commentedon Oct 28, 2016
droundy commentedon Oct 28, 2016
It just occurred to me that this is in an NFS-mounted directory, and I know NFS has some differences in locking. Flutter works fine in /tmp, which is tmpfs. So I guess maybe you can somehow identify that NFS is in use and avoid flock in that case?
Hixie commentedon Oct 28, 2016
I agree that NFS and locking don't do well, but I wouldn't have expected "Bad file descriptor"...
droundy commentedon Oct 31, 2017
Any chance that a fix for this could go in, so I could use flutter in my home directory over nfs? My current fix is to edit bin/flutter to change 'if hash flock...' to have a misspelling in flock, so that it doesn't use flock, which fails on nfs. I'm not sure what a proper fix would be, not being an expert in the use of flock.
Hixie commentedon Dec 20, 2017
The problem seems to be that NFS doesn't support exclusive locking on a file descriptor opened in read-only mode, because it wants to write in order to lock the file.
Hixie commentedon Dec 20, 2017
We could just ignore errors from
flock, I guess... if you replace theflock 3line withflock 3 || true, does it work for you?[-]flock 3: Bad file descriptor[/-][+]Can't run Flutter on NFS (flock reports "Bad file descriptor")[/+]Hixie commentedon Jan 6, 2018
Possible workaround in #13955
Hixie commentedon Jan 10, 2018
Please let me know if that didn't fix it.
droundy commentedon Jan 19, 2018
Hixie commentedon Jan 19, 2018
Awesome, thanks! Good luck with Flutter!
Roll engine to aed6b8c.
Roll engine 08272ee..04c860f (19 commits)
Roll engine 08272ee..04c860f (19 commits) (#23219)
github-actions commentedon Sep 4, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.