That's InterSystems IRIS logs. You need OS logs, namely syslog (check /var/log/syslog or /var/log/messages). Search for log entries about the "killed process" around the time your process was killed.

To be extra sure run write $job before calling the query to get process id. It should match the id of a killed process.

After you establish that your process was killed by OOM you need to report that to WRC, as a fix probably requires if not access, then at least overview of the production configuration which causes it.

Let's see how much time does it take to run in a non web context. There would be no timeouts in that case.

Could you please run this in your interoperability namespace:

set start=$h,rs=##class(Ens.InterfaceMaps.Utils).EnumeratePathsFunc(),end=$h
write "Time in seconds: ", $p(end, ",", 2)-$p(start, ",", 2)

If you run the query in SMP with parameters set them here too. EnumeratePaths query docs.

Also after you obtain the result set, you can output it to a terminal using %Display method, or to a file using %DisplayFormatted method.