public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/107235] New: m2/boot-bin/mc leaks file descriptors
@ 2022-10-12 12:21 ro at gcc dot gnu.org
  2022-10-12 12:21 ` [Bug modula2/107235] " ro at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ro at gcc dot gnu.org @ 2022-10-12 12:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107235

            Bug ID: 107235
           Summary: m2/boot-bin/mc leaks file descriptors
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
            Target: *-*-solaris2.11

Building the current devel/modula-2 branch on Solaris 11.3/SPARC fails like
this:

m2/boot-bin/mc --olang=c++ --h-file-prefix=G
-I/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-libs
-I/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-compiler
-I/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-libiberty
-I/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-gcc --quiet  --gcc-config-system
--extended-opaque -o=m2/gm2-compiler-boot/M2GCCDeclare.c
/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-compiler/M2GCCDeclare.mod
failed to open
/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-compiler/M2GCCDeclare.mod

(same for m2/gm2-libs/NumberIO.def).

Running mc under truss reveals

8687/1:        
open("/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-libs/Debug.def",
O_RDONLY|O_XPG4OPEN) = 255
[...]
8687/1:        
open("/vol/gcc/src/hg/master/modula-2/gcc/m2/gm2-compiler/M2GCCDeclare.mod",
O_RDONLY|O_XPG4OPEN) Err#24 EMFILE
8687/1:         write(2, " f a i l e d   t o   o p".., 84)      = 84

The file is opened several times (and apparent never closed), but the last
attempt (which would use fd 256) fails with EMFILE.  This happens because
Solaris up to 11.3 has a low fd limit of 255.

Raising the resource limit to (say 1024) allows the open to succeed, but mc
fails again shortly thereafter due the the stdio's limit of 255 open files.

There's a work/hack around this by preloading

LD_PRELOAD_32=/usr/lib/extendedFILE.so.1

tjat allows the build to continue, but I'm pretty certain that mc leaks fds
here and could easily avoid this issue by closing files when they are no longer
needed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug modula2/107235] m2/boot-bin/mc leaks file descriptors
  2022-10-12 12:21 [Bug modula2/107235] New: m2/boot-bin/mc leaks file descriptors ro at gcc dot gnu.org
@ 2022-10-12 12:21 ` ro at gcc dot gnu.org
  2022-11-03 15:10 ` gaius at gcc dot gnu.org
  2022-11-08 12:50 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2 siblings, 0 replies; 4+ messages in thread
From: ro at gcc dot gnu.org @ 2022-10-12 12:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107235

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug modula2/107235] m2/boot-bin/mc leaks file descriptors
  2022-10-12 12:21 [Bug modula2/107235] New: m2/boot-bin/mc leaks file descriptors ro at gcc dot gnu.org
  2022-10-12 12:21 ` [Bug modula2/107235] " ro at gcc dot gnu.org
@ 2022-11-03 15:10 ` gaius at gcc dot gnu.org
  2022-11-08 12:50 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2 siblings, 0 replies; 4+ messages in thread
From: gaius at gcc dot gnu.org @ 2022-11-03 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107235

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Now fixed.  I've added a fclose to function mcflex_openSource in mc.flex.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug modula2/107235] m2/boot-bin/mc leaks file descriptors
  2022-10-12 12:21 [Bug modula2/107235] New: m2/boot-bin/mc leaks file descriptors ro at gcc dot gnu.org
  2022-10-12 12:21 ` [Bug modula2/107235] " ro at gcc dot gnu.org
  2022-11-03 15:10 ` gaius at gcc dot gnu.org
@ 2022-11-08 12:50 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2 siblings, 0 replies; 4+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2022-11-08 12:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107235

--- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
> Now fixed.  I've added a fclose to function mcflex_openSource in mc.flex.

Confirmed on all of i386-pc-solaris2.11, amd64-pc-solaris2.11, and
sparcv9-sun-solaris2.11.

Thanks.
        Rainer

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-08 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 12:21 [Bug modula2/107235] New: m2/boot-bin/mc leaks file descriptors ro at gcc dot gnu.org
2022-10-12 12:21 ` [Bug modula2/107235] " ro at gcc dot gnu.org
2022-11-03 15:10 ` gaius at gcc dot gnu.org
2022-11-08 12:50 ` ro at CeBiTec dot Uni-Bielefeld.DE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).