Skip to contentSkip to conversation

endless loop open child logfiles

DISCUSSION Toralf Förster 2 participants 2 messages Aug 29, 2014

lore
Share & tools
lore
#0 lore raw

If a (small) file system is fullfilled, then there's an endless loop in opening logiles, tested with 4 childs in a KVM within a 97 MB big BTRFS file system created in a file in a ramdisk, commands are :

$> mkdir /mnt/ramdisk/btrfs; truncate -s 97M /mnt/ramdisk/btrfs.fs; /sbin/mkfs.btrfs /mnt/ramdisk/btrfs.fs; sudo su -c "mount -o loop,compress=lzo /mnt/ramdisk/btrfs.fs /mnt/ramdisk/btrfs; chmod 777 /mnt/ramdisk/btrfs"

$> D=/mnt/ramdisk/btrfs; while [[ : ]]; do cd ~; sudo rm -rf $D/t3; mkdir $D/t3 || break; cd $D/t3; mkdir -p v1/v2; for i in $(seq 0 99); do touch v1/v2/f$i; mkdir v1/v2/d$i; done; trinity -C 4 -N 100000 -V $D/t3/v1/v2; echo; echo " done"; echo; sleep 4; done

Signature · 2 lines
Toralf
pgp key: 0076 E94E
#1 lore raw
Quoted 6 lines · Toralf Förster

If a (small) file system is fullfilled, then there's an endless loop in opening logiles, tested with 4 childs in a KVM within a 97 MB big BTRFS file system created in a file in a ramdisk, commands are :

$> mkdir /mnt/ramdisk/btrfs; truncate -s 97M /mnt/ramdisk/btrfs.fs; /sbin/mkfs.btrfs /mnt/ramdisk/btrfs.fs; sudo su -c "mount -o loop,compress=lzo /mnt/ramdisk/btrfs.fs /mnt/ramdisk/btrfs; chmod 777 /mnt/ramdisk/btrfs"

$> D=/mnt/ramdisk/btrfs; while [[ : ]]; do cd ~; sudo rm -rf $D/t3; mkdir $D/t3 || break; cd $D/t3; mkdir -p v1/v2; for i in $(seq 0 99); do touch v1/v2/f$i; mkdir v1/v2/d$i; done; trinity -C 4 -N 100000 -V $D/t3/v1/v2; echo; echo " done"; echo; sleep 4; done

short on time right now, but try this..

Dave

include/exit.h +2 -1
index 948ecea02112..ebbaf98cfaac 100644
@@ -19,8 +19,9 @@ enum exit_reasons {
 	EXIT_FD_INIT_FAILURE = 13,
 	EXIT_FORK_FAILURE = 14,
 	EXIT_LOCKING_CATASTROPHE = 15,
+	EXIT_LOGFILE_OPEN_ERROR = 16,
 
-	NUM_EXIT_REASONS = 16
+	NUM_EXIT_REASONS = 17
 };
 
 const char * decode_exit(void);
log.c +3 -1
index 22b72db86f3c..0ccd1ba45cc9 100644
@@ -60,8 +60,10 @@ void open_child_logfile(struct childdata *child)
 	sprintf(logfilename, "trinity-child%u.log", child->num);
 
 	child->logfile = open_logfile(logfilename);
-	if (!child->logfile)
+	if (!child->logfile) {
+		shm->exit_reason = EXIT_LOGFILE_OPEN_ERROR;
 		exit(EXIT_FAILURE);
+	}
 
 	free(logfilename);
 
main.c +1 -0
index 5541de09ae7e..ed3d02c0d4e5 100644
@@ -295,6 +295,7 @@ static const char *reasons[NUM_EXIT_REASONS] = {
 	"Something happened during fd init.",
 	"fork() failure",
 	"some kind of locking catastrophe",
+	"error while opening logfiles",
 };
 
 const char * decode_exit(void)