I'm experiencing a weird issue, and wondering if anyone has seen this, and better yet has a solution. At work we are getting lots of issues with 'permission denied' or 'network not found' and so forth when reading and writing between our machines and a file server. This happens randomly so the following function solves the problem for 'cat' commands: catSafer <- function (..., ReTries = 20, ThrowError = TRUE) { for (catsi in seq_len(ReTries)) { res <- try(cat(...)) if (!inherits(res, "try-error")) break } if (inherits(res, "try-error")) { if (ThrowError) { stop("file connection failed") } else { warning("file connection failed") } } } People have done network traces and such, but so far nothing has been seen. Thanks, Pat -- Patrick Burns pburns at pburns.seanet.com http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of: 'Impatient R' 'The R Inferno' 'Tao Te Programming')
? Mon, 31 Jul 2023 16:43:17 +0100 Patrick Burns <pburns at pburns.seanet.com> ?????:> At work we are getting lots of issues with 'permission denied' or > 'network not found' and so forth when reading and writing between our > machines and a file server. This happens randomly so the following > function solves the problem for 'cat' commandsThese sound like error codes returned from the operating system, which R has no choice but forward to the user. (Well, in this case the error turns out to be transient, but files are unfortunately fraught with peril with no easy solutions [*].) Even using system call tracing or setting a symbolic debugger breakpoint on an error return from cat() will only tell you the OS error code and the file on which the operation failed, both of which you already know. Getting to the root of the problem will likely involve drilling down into the details of the exact networked filesystem used, which R is supposed to know nothing about. Maybe you could ask on ServerFault or on #linux / #windows / #<applicable server OS> on Libera.Char? -- Best regards, Ivan [*] https://danluu.com/deconstruct-files/