Subject: | Time::Format makes endless loop on forking |
If you use Time::Format in any of your modules, your program gets
non-forkable.
Unless any other module I know, Time::Format opens itself as
filedescriptor. You can see it in lsof:
# lsof -p 4246
....
perl 4246 root 8r REG 0,13 31092 25419
/usr/share/perl5/Time/Format.pm (/dev/root)
...
#
If you then fork and run a funktion of Time::Format the fork ends in a
endless loop, as you can see in strace:
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=31092, ...}) = 0
read(8, "", 4096) = 0
Please don't open files unless you programm it to be fork safe!