[Tikzdevice-bugs] Error in createLockFile(lockname) : cannot create lock file

401 views
Skip to first unread message

Vegard Nossum

unread,
May 23, 2011, 9:51:41 AM5/23/11
to tikzdev...@r-forge.wu-wien.ac.at
Hi,

I got this error:

> tikz(file="plot.tex")
> cr.plots(lm(A ~ B, data = C), ask = F)
Error in createLockFile(lockname) : cannot create lock file

By some googling, I found a similar report (with no replies):

http://r.789695.n4.nabble.com/debug-R-device-plot-tt3403638.html

So what's wrong is that I had earlier aborted cr.plots() by pressing
ctrl-C, and it appears that somebody didn't clean up the
tikzMetricDictionary lock file. Moreover, tikzDevice appears to
proceed to call close(-1) if creating the file fails (strace output):

open("/tmp/Rtmp1HU5cv/tikzMetricsDictionary", O_RDONLY) = 4
open("/tmp/Rtmp1HU5cv/tikzMetricsDictionary___LOCK",
O_WRONLY|O_CREAT|O_EXCL, 0666) = -1 EEXIST (File exists)
close(4294967295) = -1 EBADF (Bad file descriptor)
write(2, "Error in createLockFile(lockname"..., 60) = 60

Removing the ___LOCK file fixed things for me.

Just wanted to let you know. My version of R is 2.10.0 (2009-10-26)
and my version of tikzDevice is 0.5.3.


Vegard
_______________________________________________
Tikzdevice-bugs mailing list
Tikzdev...@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs

Cameron Bracken

unread,
May 23, 2011, 4:39:17 PM5/23/11
to Vegard Nossum, tikzdevice-bugs
Vegard,

Thanks, we had a report of this a while back and our suggestion then was:

> You need to look for a file (it may not be in your project directory) that contains "___LOCK" in its file name and delete it. filehash creates this to prevent multiple writes to the same file at the same time and somehow it did not get removed correctly.

So if you encounter this again, the only real solution I know if is to
remove this file manually, since this is a file created by filehash.

-Cameron

Sharpie

unread,
May 23, 2011, 6:20:05 PM5/23/11
to tikzd...@googlegroups.com, tikzdev...@r-forge.wu-wien.ac.at
On Monday, May 23, 2011 6:51:41 AM UTC-7, Vegard Nossum wrote:
>
> Hi,
>
> I got this error:
>
> > tikz(file="plot.tex")
> > cr.plots(lm(A ~ B, data = C), ask = F)
> Error in createLockFile(lockname) : cannot create lock file
>
> By some googling, I found a similar report (with no replies):
>
> http://r.789695.n4.nabble.com/debug-R-device-plot-tt3403638.html
>
> So what's wrong is that I had earlier aborted cr.plots() by pressing
> ctrl-C, and it appears that somebody didn't clean up the
> tikzMetricDictionary lock file. Moreover, tikzDevice appears to
> proceed to call close(-1) if creating the file fails (strace output):
>
> open("/tmp/Rtmp1HU5cv/tikzMetricsDictionary", O_RDONLY) = 4
> open("/tmp/Rtmp1HU5cv/tikzMetricsDictionary___LOCK",
> O_WRONLY|O_CREAT|O_EXCL, 0666) = -1 EEXIST (File exists)
> close(4294967295) = -1 EBADF (Bad file descriptor)
> write(2, "Error in createLockFile(lockname"..., 60) = 60
>
> Removing the ___LOCK file fixed things for me.
>
> Just wanted to let you know. My version of R is 2.10.0 (2009-10-26)
> and my version of tikzDevice is 0.5.3.
>
>
> Vegard
>
A stray lockfile can happen if R is interrupted while the tikzDevice is
accessing the metrics dictionary which is managed by the filehash package.
The operations shown by `strace` are actually happening inside the filehash
package, not the tikzDevice. I don't know if adding code that tries to
automatically clean up the lockfile would be a wise idea as it may
cause unforeseen side effects, especially in cases where multiple R
processes are sharing the same metrics file. Having to stop everything and
remove the lockfile is a pain, but probably less of a pain than having to
remove a corrupted metrics dictionary.

-Charlie

Ahs

unread,
Dec 1, 2012, 4:23:49 PM12/1/12
to tikzd...@googlegroups.com, tikzdev...@r-forge.wu-wien.ac.at, vegard...@gmail.com
Hi,
I also got the Error in createLockFile(lockname) : cannot create lock file
with tikz.

After a couple of days of strugging, what solved it was creating a
.RProfile file in wd,
including the line
options( tikzMetricsDictionary='tikzMetricsDictionary' )
where the path is the wd.

Naive, but works for me!
> Tikzdev...@lists.r-forge.r-project.org <javascript:>
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs
>
Reply all
Reply to author
Forward
0 new messages