It's hard to reproduce this problem, but looking at the code it's pretty clear what the problem is.
In R-3.3.2/src/library/grDevices/src/devPS.c, function PDF_NewPage, around line 7221:
pd->pdffp = fopen(tmp, "w+b");
if(! pd->pdffp) error("cannot open file '%s', reason %s",
Note that tmp is freed before the error message is created. On my system, the memory manager appears to write a null byte at the beginning of the buffer when free() is called, resulting in this error message:
Error in plot.new() :
cannot open file '', reason No such file or directory
The original problem is not R's bug -- I think the file system TMPDIR is pointing to gets unmounted by a long-running R job. However, the fact that the error message is broken made it harder for me to diagnose the problem. I don't know what kind of try/catch/finally mechanism R uses, but ideally free(tmp) would happen after error() is called.
Note also that R eventually dumps core, which I care about less than the broken error message.
#0 0x00000037ff467934 in fwrite () from /lib64/libc.so.6
#1 0x00002ae33b8c10e2 in PDF_endpage () at devPS.c:6509
#2 0x00002ae33b8c284b in PDF_Close () at devPS.c:7257
#3 0x00002ae338dbf05e in removeDevice.part.0 ()
#4 0x00002ae338dbf4c9 in Rf_KillAllDevices ()
#5 0x00002ae338ee42e4 in Rstd_CleanUp ()
#6 0x00002ae338e21947 in run_Rmainloop ()
#7 0x00000000004007bb in main () at Rmain.c:29
Here's how I could reliably trigger the problem (on Ubuntu 14.04) ...
## Make tempdir() unwritable
system(paste("chmod a-w", tempdir()))
## compression is on by default
## Incorrect error message is in PDF_NewPage()
## This triggers a segfault (for me at least)
I have committed a fix to r-devel (r71752) so that, in addition to giving a better message (and not segfaulting), the error is now a warning and compression is turned off for the PDF device.