Pocket Plane Group

Friends and Neighbors => Weimer Republic (WeiDU.org) => WeiDU => Topic started by: Argent77 on November 22, 2017, 01:58:28 PM

Title: [solved] WeiDU triggers "Too many open files" error with COPY_EXISTING_REGEXP
Post by: Argent77 on November 22, 2017, 01:58:28 PM
Original post: http://gibberlings3.net/forums/index.php?showtopic=29055&p=257456

The following code snippet seems to fail on OS X in an EET installation with a "Too many open files" error:
Code: [Select]
OUTER_TEXT_SPRINT folder_input ~%MOD_FOLDER%/temp/in~
MKDIR ~%folder_input%~
COPY_EXISTING_REGEXP + ~.+\.pvrz~ ~%folder_input%~

Full error message:
Code: [Select]
Copying 7185 files ...
ERROR: COPY ~B070000.PVRZ~ ~A7-CopyTest/temp/in/B070000.PVRZ~ FAILED: cannot open target
Stopping installation because of error.

ERROR Installing [Mass copy test], rolling back to previous state
WARNING: Unable to write tlk-path uninstall info to [A7-CopyTest/backup/0/TLKPATH.0]: Sys_error("A7-CopyTest/backup/0/TLKPATH.0: Too many open files")
Will uninstall 0 files for [A7-COPYTEST/SETUP-A7-COPYTEST.TP2] component 0.
Uninstalled 0 files for [A7-COPYTEST/SETUP-A7-COPYTEST.TP2] component 0.
ERROR: Sys_error("A7-CopyTest/temp/in/B070000.PVRZ: Too many open files")
Title: Re: [macOS] WeiDU triggers "Too many open files" error with COPY_EXISTING_REGEXP
Post by: Wisp on November 23, 2017, 02:59:07 PM
No idea. I assume this code works on not-macOS with an equal number of files?

COPY loads the file with Util.load_file, which raises an intended-to-be fatal exception if it can't close the file. The buffer is later written by this code (https://github.com/WeiDUorg/weidu/blob/414b1dfa0d6d80b18bad7c2d30d691225a68f67f/src/tpaction.ml#L751), which is printing the error and raising the exception in this case. The out file is also closed properly.

(Incidentally, both of the aforementioned exceptions are among those unsafe exceptions I was warning about a while back; using TRY to catch these exception and not terminating the installation would result in the mod continuing on, with the file remaining open.)

Edit: fixed code tag.
Title: Re: [macOS] WeiDU triggers "Too many open files" error with COPY_EXISTING_REGEXP
Post by: AstroBryGuy on December 04, 2017, 04:26:22 PM
Argent77 - What version of macOS are you running? Apple set the maxfiles on Sierra/High Sierra to 256(!?!) files per process.

This post has instructions for increasing the maxfiles settings in Sierra/High Sierra.

https://content.nanobox.io/fixing-too-many-open-files-in-macos/
Title: Re: [macOS] WeiDU triggers "Too many open files" error with COPY_EXISTING_REGEXP
Post by: Argent77 on December 05, 2017, 09:04:55 AM
This bug report was based on feedback from subtledoctor (see link in first post). I can't even run the binary that is executed by the mod in question on my own OSX system anymore. I'm using Mac OS X 10.7.4 (Lion) on a virtual machine, which is only good for compiling and testing stuff.
Title: Re: [macOS] WeiDU triggers "Too many open files" error with COPY_EXISTING_REGEXP
Post by: subtledoctor on December 14, 2017, 10:26:52 AM
It's been solved, looks like a problem in MacOS Sierra, not in Weidu.