IOSError 24 on stepping past file open

I am using 2022 R3.

I keep getting this error on a call of a subroutine whose sole job is to open a text file and return it. The file definitely exists and is also true in the debugger.

Whenever I step into this one section of code for this one file, I get this error. Yes not any where else but this one.

Var rCardtis As TextInputStream
Var fa As FolderItem

If fa.Exists Then
rCardtis = TextInputStream.Open(fa)//Error 24 at this line
End If

When I ran Error 24 in Terminal this is what I got:

Mac OS error 24 (dsNoPk7): package 7 not present

Any suggestions?

Except that it’s an IOError 24 which is “Too Many Open Files”

I agree. That is very confusing. I know that too many files is not possible since I keep only one file at a time open. Also the file is on the hard drive.

The question is “IOSError24 on stepping past file open”. But yoy tell that you get this when running on MacOS.

So what is the correct OS ? We need to know to help you.

Thanks

The code you posted makes a NOE at fa.exists because fa is nil.

If Not fa = Nil And fa.Exists Then

That’s gotta be a typo

Too many files open is for the whole system, not just your app. If you look at that link I sent you, there’s a suggestion about temporarily increasing the limit to check.

Also the file is on the hard drive.

Right. Too many files open on any drive connected to your system.

Thanks Greg

Code Correction

If f <> Nil And f.Exists Then

The example on Stasckexchange has this

ulimit -n 4096

In the LR us this example

ulimit -c unlimited

So I think the -n is related to “Files Open”, but I don’t see how I can put this in Code.
Where and how do I enter this in code?

On the CLI ulimit you are modifying the shell session limits. Your App gained its limits from the launcher, BEFORE. So I guess you will need to change your launcher limits, and relaunch your app.

To see your current limits run:

launchctl limit maxfiles

To change it to the max run:

sudo launchctl limit maxfiles 10240 10240

The second number is the soft limit, and can be bigger than the hard limit, but why would we want that?

But… Why are you letting so many files left open at once? Maybe your app design could need a rethinking?

1 Like

That’s the code in StackExchange. I guess I didn’t make it clear enough.

So you are reporting an unreal problem of a random code from StackExchange? Ok. Come back when you have some real problem. :man_shrugging:t2: But if you HAD something like that, the solutions are provided. And the best one probably would be an app redesign. :wink:

Please read the whole post before you defame someone. Greg pointed out the exchange long after I posted my question.

1 Like

I ran it in Terminal and the response is

maxfiles 256 unlimited

I am done looking at this

1 Like

As expected.

But what if you run:

sudo launchctl limit maxfiles 999 unlimited

And only after you run

launchctl limit maxfiles

I see you are running some ‘old’ macOS, because “unlimited” string is not allowed as response anymore and the “keyword” equals to 10240 in this context, currently, for compatibility reasons.

Also, 256 was increased in newer macOS versions.

macOS Big Sur. 11.7.8

Thanks
I’m done with chasing this

No need to chase. You just need to run what I explained, but Ok.

I ran the line in terminal and it no longer gave the error when I stepped thru.

I ran the above line and it was back to 256. Maybe it just wanted to noticed, but it no longer fails.