[GHC] #13945: make install fails when registering packages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GHC] #13945: make install fails when registering packages

GHC - devs mailing list
#13945: make install fails when registering packages
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In the final part of installation when packages are registered, the
 following command fails

 {{{
 "inplace/bin/ghc-cabal" register libraries/ghc-prim dist-install
 "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc"
 "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
 pkg" "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708" ''
 '/home/pgrads/mp16005/linux/installed-ghc' '/home/pgrads/mp16005/linux
 /installed-ghc/lib/ghc-8.2.0.20170708' '/home/pgrads/mp16005/linux
 /installed-ghc/share/doc/ghc-8.2.0.20170708/html/libraries' NO
 }}}

 with the following output

 {{{
 Registering library for ghc-prim-0.5.0.0..
 ghc-cabal:
 '/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
 pkg'
 exited with an error:
 ghc-pkg: Couldn't open database
 /home/pgrads/mp16005/linux/installed-
 ghc/lib/ghc-8.2.0.20170708/package.conf.d
 for modification: {handle:
 /home/pgrads/mp16005/linux/installed-
 ghc/lib/ghc-8.2.0.20170708/package.conf.d/package.cache.lock}:
 hLock: invalid argument (Bad file descriptor)
 }}}

 It might be something to do with the permissions I have on my machine but
 I used to be able to install ghc if I gave it a suitable prefix other than
 `/usr/local`.

 Here is the call stack from the crash if that's useful.

 {{{
 CallStack (from HasCallStack):
   die', called at
 libraries/Cabal/Cabal/Distribution/Simple/Program/Run.hs:142:7 in
 main:Distribution.Simple.Program.Run
   runProgramInvocation, called at
 libraries/Cabal/Cabal/Distribution/Simple/Program/HcPkg.hs:167:5 in
 main:Distribution.Simple.Program.HcPkg
   register, called at
 libraries/Cabal/Cabal/Distribution/Simple/GHC.hs:1709:5 in
 main:Distribution.Simple.GHC
   registerPackage, called at
 libraries/Cabal/Cabal/Distribution/Simple/Register.hs:350:14 in
 main:Distribution.Simple.Register
   registerPackage, called at
 libraries/Cabal/Cabal/Distribution/Simple/Register.hs:172:16 in
 main:Distribution.Simple.Register
   registerAll, called at
 libraries/Cabal/Cabal/Distribution/Simple/Register.hs:125:5 in
 main:Distribution.Simple.Register
   register, called at libraries/Cabal/Cabal/Distribution/Simple.hs:770:10
 in main:Distribution.Simple
   defaultRegHook, called at
 libraries/Cabal/Cabal/Distribution/Simple.hs:584:20 in
 main:Distribution.Simple
   regHook, called at
 libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:120:5 in
 main:Distribution.Simple.UserHooks
   regHook, called at
 libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:120:5 in
 main:Distribution.Simple.UserHooks
   cmd_hook, called at libraries/Cabal/Cabal/Distribution/Simple.hs:452:38
 in main:Distribution.Simple
   cmd_hook, called at libraries/Cabal/Cabal/Distribution/Simple.hs:469:4
 in main:Distribution.Simple
   hookedActionWithArgs, called at
 libraries/Cabal/Cabal/Distribution/Simple.hs:451:5 in
 main:Distribution.Simple
   hookedAction, called at
 libraries/Cabal/Cabal/Distribution/Simple.hs:430:5 in
 main:Distribution.Simple
   registerAction, called at
 libraries/Cabal/Cabal/Distribution/Simple.hs:184:50 in
 main:Distribution.Simple
   defaultMainHelper, called at
 libraries/Cabal/Cabal/Distribution/Simple.hs:133:28 in
 main:Distribution.Simple
   defaultMainWithHooksArgs, called at utils/ghc-cabal/Main.hs:214:6 in
 main:Main
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error (was: make install fails when registering packages)

GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mpickering):

 * cc: goldfire (added)


@@ -35,1 +35,3 @@
- Here is the call stack from the crash if that's useful.
+ A workaround is to make sure that `HAVE_FLOCK` is not defined, the way I
+ did this was commenting out the three relevant lines in
+ libraries/base/configure.ac.
@@ -37,50 +39,7 @@
- {{{
- CallStack (from HasCallStack):
-   die', called at
- libraries/Cabal/Cabal/Distribution/Simple/Program/Run.hs:142:7 in
- main:Distribution.Simple.Program.Run
-   runProgramInvocation, called at
- libraries/Cabal/Cabal/Distribution/Simple/Program/HcPkg.hs:167:5 in
- main:Distribution.Simple.Program.HcPkg
-   register, called at
- libraries/Cabal/Cabal/Distribution/Simple/GHC.hs:1709:5 in
- main:Distribution.Simple.GHC
-   registerPackage, called at
- libraries/Cabal/Cabal/Distribution/Simple/Register.hs:350:14 in
- main:Distribution.Simple.Register
-   registerPackage, called at
- libraries/Cabal/Cabal/Distribution/Simple/Register.hs:172:16 in
- main:Distribution.Simple.Register
-   registerAll, called at
- libraries/Cabal/Cabal/Distribution/Simple/Register.hs:125:5 in
- main:Distribution.Simple.Register
-   register, called at libraries/Cabal/Cabal/Distribution/Simple.hs:770:10
- in main:Distribution.Simple
-   defaultRegHook, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:584:20 in
- main:Distribution.Simple
-   regHook, called at
- libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:120:5 in
- main:Distribution.Simple.UserHooks
-   regHook, called at
- libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:120:5 in
- main:Distribution.Simple.UserHooks
-   cmd_hook, called at libraries/Cabal/Cabal/Distribution/Simple.hs:452:38
- in main:Distribution.Simple
-   cmd_hook, called at libraries/Cabal/Cabal/Distribution/Simple.hs:469:4
- in main:Distribution.Simple
-   hookedActionWithArgs, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:451:5 in
- main:Distribution.Simple
-   hookedAction, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:430:5 in
- main:Distribution.Simple
-   registerAction, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:184:50 in
- main:Distribution.Simple
-   defaultMainHelper, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:133:28 in
- main:Distribution.Simple
-   defaultMainWithHooksArgs, called at utils/ghc-cabal/Main.hs:214:6 in
- main:Main
- }}}
+ geekosaur suggests on IRC that the problem might be
+
+ > what might be possible is that hLock uses fcntl locking, ghc-pkg opens a
+ database r/o if it can't open it > r/w, and it tried to acquire a write
+ lock (which will fail with EBADF if the file descriptor is only open for >
+ > read). and there is an SElinux context prohibiting your process opening
+ the db for write

New description:

 In the final part of installation when packages are registered, the
 following command fails

 {{{
 "inplace/bin/ghc-cabal" register libraries/ghc-prim dist-install
 "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc"
 "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
 pkg" "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708" ''
 '/home/pgrads/mp16005/linux/installed-ghc' '/home/pgrads/mp16005/linux
 /installed-ghc/lib/ghc-8.2.0.20170708' '/home/pgrads/mp16005/linux
 /installed-ghc/share/doc/ghc-8.2.0.20170708/html/libraries' NO
 }}}

 with the following output

 {{{
 Registering library for ghc-prim-0.5.0.0..
 ghc-cabal:
 '/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
 pkg'
 exited with an error:
 ghc-pkg: Couldn't open database
 /home/pgrads/mp16005/linux/installed-
 ghc/lib/ghc-8.2.0.20170708/package.conf.d
 for modification: {handle:
 /home/pgrads/mp16005/linux/installed-
 ghc/lib/ghc-8.2.0.20170708/package.conf.d/package.cache.lock}:
 hLock: invalid argument (Bad file descriptor)
 }}}

 It might be something to do with the permissions I have on my machine but
 I used to be able to install ghc if I gave it a suitable prefix other than
 `/usr/local`.

 A workaround is to make sure that `HAVE_FLOCK` is not defined, the way I
 did this was commenting out the three relevant lines in
 libraries/base/configure.ac.

 geekosaur suggests on IRC that the problem might be

 > what might be possible is that hLock uses fcntl locking, ghc-pkg opens a
 database r/o if it can't open it > r/w, and it tried to acquire a write
 lock (which will fail with EBADF if the file descriptor is only open for >
 > read). and there is an SElinux context prohibiting your process opening
 the db for write

--

Comment:

 I updated the ticket as I think this will be a more general problem using
 8.2.1 on any system where these restrictions exist. I can't properly
 diagnose the problem but geekosaur speculates an explanation which seemed
 plausible.

 This also seems the same issue that Richard was having back in March.
 https://mail.haskell.org/pipermail/ghc-devs/2017-March/013915.html

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mpickering):

 * priority:  normal => high
 * version:  8.0.1 => 8.2.1-rc3


Comment:

 I confirmed this happens with the `ghc-8.2.1-rc3` bindist as well.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 With a `NO_FLOCK` build, I have to compile package with cabal with `-j1`
 otherwise very strange errors happen.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------
Changes (by bgamari):

 * os:  Unknown/Multiple => Linux


--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------
Description changed by bgamari:

@@ -42,4 +42,4 @@
- database r/o if it can't open it > r/w, and it tried to acquire a write
- lock (which will fail with EBADF if the file descriptor is only open for >
- > read). and there is an SElinux context prohibiting your process opening
- the db for write
+ database r/o if it can't open it r/w, and it tried to acquire a write lock
+ (which will fail with EBADF if the file descriptor is only open for read).
+ and there is an SElinux context prohibiting your process opening the db
+ for write

New description:

 In the final part of installation when packages are registered, the
 following command fails

 {{{
 "inplace/bin/ghc-cabal" register libraries/ghc-prim dist-install
 "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc"
 "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
 pkg" "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708" ''
 '/home/pgrads/mp16005/linux/installed-ghc' '/home/pgrads/mp16005/linux
 /installed-ghc/lib/ghc-8.2.0.20170708' '/home/pgrads/mp16005/linux
 /installed-ghc/share/doc/ghc-8.2.0.20170708/html/libraries' NO
 }}}

 with the following output

 {{{
 Registering library for ghc-prim-0.5.0.0..
 ghc-cabal:
 '/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
 pkg'
 exited with an error:
 ghc-pkg: Couldn't open database
 /home/pgrads/mp16005/linux/installed-
 ghc/lib/ghc-8.2.0.20170708/package.conf.d
 for modification: {handle:
 /home/pgrads/mp16005/linux/installed-
 ghc/lib/ghc-8.2.0.20170708/package.conf.d/package.cache.lock}:
 hLock: invalid argument (Bad file descriptor)
 }}}

 It might be something to do with the permissions I have on my machine but
 I used to be able to install ghc if I gave it a suitable prefix other than
 `/usr/local`.

 A workaround is to make sure that `HAVE_FLOCK` is not defined, the way I
 did this was commenting out the three relevant lines in
 libraries/base/configure.ac.

 geekosaur suggests on IRC that the problem might be

 > what might be possible is that hLock uses fcntl locking, ghc-pkg opens a
 database r/o if it can't open it r/w, and it tried to acquire a write lock
 (which will fail with EBADF if the file descriptor is only open for read).
 and there is an SElinux context prohibiting your process opening the db
 for write

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 mpickering is using CentOS (which indeed uses SELinux, IIRC). goldfire,
 are you as well?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by j.waldmann):

 I too am seeing this error when doing "make install" after building rc3
 from source, configured with a non-standard prefix, on Debian, where the
 target directory is on an nfs-mounted volume.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 J.waldmann, is the NFS lock daemon running?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------
Changes (by bgamari):

 * milestone:   => 8.2.2


--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 I am able to reproduce this locally. Here is a small reproducer,
 {{{#!c
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/file.h>

 int main () {
   int fd = open("libraries/bootstrapping.conf/package.cache.lock",
 O_RDONLY|O_NOCTTY|O_NONBLOCK);
   int res;

   struct stat stat;
   res = fstat(fd, &stat);
   printf("stat: %s\n", strerror(errno));

   res = flock(fd, LOCK_EX);
   printf("flock: %s\n", strerror(errno));

   res = flock(fd, LOCK_UN);
   printf("funlock: %s\n", strerror(errno));

   close(fd);
   return 0;
 }
 }}}

 When run in an NFS-mounted GHC tree with an existing lockfile this will
 fail with,
 {{{
 $ gcc test.c && ./a.out
 stat: Success
 flock: Bad file descriptor
 funlock: Bad file descriptor
 }}}

 Strangely if one changes `O_RDONLY` to `O_RDWR` the failure becomes,
 {{{
 $ gcc test.c && ./a.out
 stat: Success
 flock: No locks available
 funlock: No locks available
 }}}
 So I think this may be in part due to the read-only nature of the fd, but
 there may be more at play.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------
Changes (by bgamari):

 * Attachment "test.c" added.

 An end-to-end testcase

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 Here is a standalone test. I have confirmed that this runs on my local
 filesystem, yet not on my NFS mount (where both the server and client are
 running `statd`, `rpcbind`, and `portmapper`).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 Ahh, the issue appears to be that NFS is more strict about the privileges
 necessary to take an exclusive (`LOCK_EX`) `flock`. Namely, you need write
 access. If you only have read access to a file then you can only take a
 `LOCK_SH` lock.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  patch
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):  Phab:D3897
       Wiki Page:                |
---------------------------------+----------------------------------------
Changes (by bgamari):

 * status:  new => patch
 * differential:   => Phab:D3897


Comment:

 So this is problematic: `lockPackageDb` first tries to open (and then
 exclusively lock) the lockfile as read-only to account for the possibility
 that we are opening a global package database for which we only have read
 access. However, NFS does not allow this as mentioned above.

 I believe Phab:D3897 is one possible fix.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  patch
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):  Phab:D3897
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"f86de44dac0a6ca40c5fcd65f3a1944c45fa6011/ghc" f86de44/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="f86de44dac0a6ca40c5fcd65f3a1944c45fa6011"
 ghc-pkg: Try opening lockfiles in read-write mode first

 As pointed out in #13945, some filesystems only allow allow exclusive
 locks if the fd being locked was opened for write access. This causes
 ghc-pkg to fail as it first attempts to open and exclusively lock its
 lockfile in read-only mode to accomodate package databases for which we
 lack write permissions (e.g.  global package databases).

 Instead, we now try read-write mode first, falling back to read-only
 mode if this fails.

 Reviewers: austin

 Subscribers: rwbarton, thomie

 GHC Trac Issues: #13945

 Differential Revision: https://phabricator.haskell.org/D3897
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  patch
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):  Phab:D3897
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"779b9e6965416ee08af6eb15354cf09e9f40e0d9/ghc" 779b9e6/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="779b9e6965416ee08af6eb15354cf09e9f40e0d9"
 PackageDb: Explicitly unlock package database before closing

 Reviewers: austin

 Subscribers: rwbarton, thomie

 GHC Trac Issues: #13945

 Differential Revision: https://phabricator.haskell.org/D3874
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  infoneeded
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):  Phab:D3897
       Wiki Page:                |
---------------------------------+----------------------------------------
Changes (by bgamari):

 * status:  patch => infoneeded


Comment:

 My testing suggests that comment:14 should be sufficient to fix this. It
 would be great if someone could confirm this. Note that in my experience
 it is the boot compiler's `ghc-pkg` that fails, so you will need to build
 a new compiler with this patch and use it to bootstrap another tree to
 test this.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  infoneeded
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):  Phab:D3897
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by j.waldmann):

 Slightly tangential, but -

 This issue prevents me from installing ghc (8.2.1) on that specific
 machine (which I need for lab classes) as it appears both after building
 from source, and when installing a binary distribution.

 Is there a work-around? Like, configure with the correct prefix, but then
 fool
 "make install" to use some other prefix (in the local file system), then
 "cp -rvp" manually to the correct (NFS-mounted) location? (Well, running
 "make install" in a chroot could probably help.)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:17>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  infoneeded
        Priority:  high          |            Milestone:  8.2.2
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):  Phab:D3897
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 Thanks for the data point, j.waldmann.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
12