Every file parses correctly individually but when called like this it stops on the 18th file.
I was guessing maybe a limit of 20 file descriptors but I can’t find any reference to that.
And phrase_from_file calls close (inside cleanup).
What I see when debugging is that device_neighbors when called on the 18th time gets an empty list as the DCG tail.
I can do them individually but there are hundreds so it slows the process down.
Stops → fails.
I’ve run it on all files and it succeeds if done individually.
Since the DCG list is empty the 18th time it will fail to parse and hence fail the forall.
I’ve identified the failure 3 times now!
When phrase_from_file calls device_neighbors the DCG list that should be the contents of the file is empty. It’s not failing in my code. Please read what I’ve written.
I was hoping there would be some deep prology reason why it couldn’t open another file or something.
On reflection, I’ll just submit a bug report.
No, there’s no bug, not in swipl (not in my code either).
A couple of the input files had been truncated and it never occured to me to check for that before running it.
I was using gtrace, but I’ve never been able to navigate the stack without getting lost.
Anway, it was a stupid mistake not to look outside the code. Somehow those are usually the ones that end up embarassing me.