You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was writing a small script to see to what extent I could increase the test coverage in sort.c and compress.c. I have something like the following:
#-
#: TermsInSmall 128
#: LargePatches 16
#: FilePatches 4
*#: SubTermsInSmall 64
#: SubLargePatches 8
#: SubFilePatches 2
Off Statistics;
CFunction f,g;
Symbol x,y;
* 128*16=2048 terms cause a sort of the large buffer to disk.
* multiples of 2048*4=8192 terms cause a stage 4 sort
#define NTERMS "40001"
#define ARGNTERMS "2001"
Local test1 = <f(1)>+...+<f(`NTERMS')>;
Local test2 = g(<f(1)>+...+<f(`ARGNTERMS')>);
.sort
* Cancel all terms, but keep distance so that most terms only cancel in the final sort
Identify f(x?) = f(x) - f(`NTERMS'-x+1);
Argument g;
Identify f(x?) = f(x) - f(`ARGNTERMS'-x+1);
EndArgument;
Print +s;
.end
If one uncomments the #: SubTermsInSmall 64 setting, tform crashes with Unexpected code in ReNumber. form does not crash, but test2 contains many f(...) terms that are not inside g.
==7336== Conditional jump or move depends on uninitialised value(s)
==7336== at 0x5095C5: TestSub (proces.c:1622)
==7336== by 0x501D66: Generator (proces.c:3051)
==7336== by 0x503B9E: Generator (proces.c:3762)
==7336== by 0x5040BA: Generator (proces.c:3930)
==7336== by 0x50ACE9: Processor (proces.c:404)
==7336== by 0x44ABB5: DoExecute (execute.c:838)
==7336== by 0x4690CF: ExecModule (module.c:274)
==7336== by 0x4F836E: PreProcessor (pre.c:962)
==7336== by 0x544884: main (startup.c:1605)
form has no problems, but tform -w4 crashes about 60% of the time, with various errors:
Unexpected code in ReNumber
Program terminating in thread 1 at sorting.frm Line 33 -->
0FillInputGZIP: Read error during uncompressed sort.
0++Reading 4295000 bytes at position 1366592
PutIn: We have RetCode = FFFFFFFFFFFFFFFF while reading 418958 bytes
Program terminating in thread 0 at sorting.frm Line 23 -->
Program terminating in thread 4 at sorting.frm Line 23 -->
EDIT: For this, at some point before the crash, valgrind gives
==18016== Syscall param read(buf) points to unaddressable byte(s)
==18016== at 0x5B8551D: ??? (syscall-template.S:84)
==18016== by 0x520956: read (unistd.h:44)
==18016== by 0x520956: Uread (unixfile.c:134)
==18016== by 0x50F375: ReadFile (tools.c:1158)
==18016== by 0x42D7A5: FillInputGZIP (compress.c:694)
==18016== by 0x4ED173: PutIn (sort.c:1260)
==18016== by 0x4F153F: MergePatches (sort.c:3656)
==18016== by 0x4F3798: EndSort (sort.c:1066)
==18016== by 0x430DA8: CatchDollar (dollar.c:117)
==18016== by 0x4BB230: PreProcessor (pre.c:1050)
==18016== by 0x4F88A0: main (startup.c:1605)
==18016== Address 0x671d52c0 is 0 bytes after a block of size 2,560,640 alloc'd
==18016== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18016== by 0x510762: Malloc1 (tools.c:2236)
==18016== by 0x5111E0: TermMallocAddMemory (tools.c:2470)
==18016== by 0x45C57B: Normalize (normal.c:220)
==18016== by 0x4C24AF: Generator (proces.c:3064)
==18016== by 0x430D61: CatchDollar (dollar.c:112)
==18016== by 0x4BB230: PreProcessor (pre.c:1050)
==18016== by 0x4F88A0: main (startup.c:1605)
StageSort in thread 0
StageSort in thread 0
==11421== Syscall param read(buf) points to unaddressable byte(s)
==11421== at 0x32E1A0E82D: ??? (in /lib64/libpthread-2.12.so)
==11421== by 0x51C1B3: Uread (unixfile.c:134)
==11421== by 0x50B031: ReadFile (tools.c:1158)
==11421== by 0x42CF56: FillInputGZIP (compress.c:694)
==11421== by 0x4E95DB: PutIn (sort.c:1260)
==11421== by 0x4ED90D: MergePatches (sort.c:3656)
==11421== by 0x4EFB3C: EndSort (sort.c:1066)
==11421== by 0x4304D2: CatchDollar (dollar.c:117)
==11421== by 0x4B8301: PreProcessor (pre.c:1050)
==11421== by 0x4F4A43: main (startup.c:1605)
==11421== Address 0x37e9c640 is not stack'd, malloc'd or (recently) free'd
==11421==
0FillInputGZIP: Read error during uncompressed sort.
0++Reading 4295000 bytes at position 106280
PutIn: We have RetCode = FFFFFFFFFFFFFFFF while reading 418958 bytes
Program terminating in thread 0 at test.frm Line 7 -->
==11421== Invalid read of size 4
==11421== at 0x50F5F8: Crash (tools.c:3711)
==11421== by 0x4F4070: Terminate (startup.c:1707)
==11421== by 0x4E9618: PutIn (sort.c:1266)
==11421== by 0x4ED90D: MergePatches (sort.c:3656)
==11421== by 0x4EFB3C: EndSort (sort.c:1066)
==11421== by 0x4304D2: CatchDollar (dollar.c:117)
==11421== by 0x4B8301: PreProcessor (pre.c:1050)
==11421== by 0x4F4A43: main (startup.c:1605)
==11421== Address 0x0 is not stack'd, malloc'd or (recently) free'd
Now 100% it occurs (though it is not in a worker).
Looks quite useful.
I spent a few hours yesterday on this stuff and the main conclusion was that there
was a counting error in the number of patches, because somewhere an end of expression
seems to not have been seen, unless a patch was written over another patch
instead of its intended spot.
But with expressions this size it is not easy to find what causes it.
In the example, it all played in a single worker. Same with the example
that you give. The dollar expands completely inside one worker.
Jos
On 1 jul. 2017, at 21:39, Takahiro Ueda ***@***.***> wrote:
Running valgrind tvorm -w2 for
#:FilePatches 4
#:SubTermsInSmall 64
#:SubLargePatches 8
#:SubFilePatches 2
CF f;
#define NTERMS "5000"
#$x = <f(1)>+...+<f(`NTERMS')>;
.end
gives me
StageSort in thread 0
StageSort in thread 0
==11421== Syscall param read(buf) points to unaddressable byte(s)
==11421== at 0x32E1A0E82D: ??? (in /lib64/libpthread-2.12.so)
==11421== by 0x51C1B3: Uread (unixfile.c:134)
==11421== by 0x50B031: ReadFile (tools.c:1158)
==11421== by 0x42CF56: FillInputGZIP (compress.c:694)
==11421== by 0x4E95DB: PutIn (sort.c:1260)
==11421== by 0x4ED90D: MergePatches (sort.c:3656)
==11421== by 0x4EFB3C: EndSort (sort.c:1066)
==11421== by 0x4304D2: CatchDollar (dollar.c:117)
==11421== by 0x4B8301: PreProcessor (pre.c:1050)
==11421== by 0x4F4A43: main (startup.c:1605)
==11421== Address 0x37e9c640 is not stack'd, malloc'd or (recently) free'd
==11421==
0FillInputGZIP: Read error during uncompressed sort.
0++Reading 4295000 bytes at position 106280
PutIn: We have RetCode = FFFFFFFFFFFFFFFF while reading 418958 bytes
Program terminating in thread 0 at test.frm Line 7 -->
==11421== Invalid read of size 4
==11421== at 0x50F5F8: Crash (tools.c:3711)
==11421== by 0x4F4070: Terminate (startup.c:1707)
==11421== by 0x4E9618: PutIn (sort.c:1266)
==11421== by 0x4ED90D: MergePatches (sort.c:3656)
==11421== by 0x4EFB3C: EndSort (sort.c:1066)
==11421== by 0x4304D2: CatchDollar (dollar.c:117)
==11421== by 0x4B8301: PreProcessor (pre.c:1050)
==11421== by 0x4F4A43: main (startup.c:1605)
==11421== Address 0x0 is not stack'd, malloc'd or (recently) free'd
Now 100% it occurs (though it is not in a worker).
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub <#211 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AFLxEtCiO7VcmLqXwdn5Sm8HNEc_NLuAks5sJqBXgaJpZM4OKqxS>.
I guess yes.
I am still looking at the “GZIP…..” and sometimes it crashes reading, sometimes the reading
goes ‘fine’ but it crashes in ReNumber. I have also put a print somewhere else and sometimes
it crashes there. But it seems all related.
The bug is extremely crazy though.
It crashes in the example in the first module, but only if the second module is present and
has code in it. ?????????
Jos
Here is another spam of valgrind log (vorm) with increasing SortIOSize:
FORM 4.1 (Jul 3 2017, v4.1-20131025-383-gd8ae7a6-dirty) 64-bits Run: Mon Jul 3 21:05:02 2017
#:SortIOSize 10M
#:MaxTermSize 600
#:SubTermsInSmall 16
#:SubLargePatches 1
#:SubFilePatches 2
S x;
CF f;
#define NTERMS "65"
L F = f(<x^1>+...+<x^`NTERMS'>);
P;
.end
StageSort
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=4 file->POsize=10000000]
==5619== Syscall param read(buf) points to unaddressable byte(s)
==5619== at 0x32E12DB670: __read_nocancel (in /lib64/libc-2.12.so)
==5619== by 0x50E343: Uread (unixfile.c:134)
==5619== by 0x4FE08C: ReadFile (tools.c:1158)
==5619== by 0x42B0B6: FillInputGZIP (compress.c:694)
==5619== by 0x4DDD98: PutIn (sort.c:1260)
==5619== by 0x4E1AA0: MergePatches (sort.c:3656)
==5619== by 0x4E391C: EndSort (sort.c:1066)
==5619== by 0x4BC6EA: InFunction (proces.c:2057)
==5619== by 0x4B8007: Generator (proces.c:3759)
==5619== by 0x4B8463: Generator (proces.c:3931)
==5619== by 0x4B9BE3: Processor (proces.c:404)
==5619== by 0x43762D: DoExecute (execute.c:838)
==5619== Address 0x15469408 is 0 bytes after a block of size 5,100,488 alloc'd
==5619== at 0x4A05A57: malloc (vg_replace_malloc.c:299)
==5619== by 0x4FF227: Malloc1 (tools.c:2236)
==5619== by 0x4DB0B4: AllocSort (setfile.c:901)
==5619== by 0x4DDBF0: NewSort (sort.c:619)
==5619== by 0x4BC64C: InFunction (proces.c:2033)
==5619== by 0x4B8007: Generator (proces.c:3759)
==5619== by 0x4B8463: Generator (proces.c:3931)
==5619== by 0x4B9BE3: Processor (proces.c:404)
==5619== by 0x43762D: DoExecute (execute.c:838)
==5619== by 0x44DAAA: ExecModule (module.c:274)
==5619== by 0x4AFB2D: PreProcessor (pre.c:962)
==5619== by 0x4E8747: main (startup.c:1605)
==5619==
[PutIn: file->handle=4 file->POsize=10000000]
It is very strange that PutIn() is called with file->POsize=10000000, i.e., SortIOSize. Then ReadFile() overflows from the buffer allocated by AllocSort for the function argument (only 5100488 bytes, valgrind says). GDB shows it is allocated with AllocSort (LargeSize=4000000, SmallSize=500000, SmallEsize=800000, TermsInSmall=16, MaxPatches=1, MaxFpatches=4, IOsize=32768). For TFORM, instead of SortIOSize, the value calculated from AM.S0->file.POsize is used (see threads.c:541).
What this seems to indicate that somehow the function/dollar POsize is, under certain
circumstances, borrowed from the level 0 one.
I’ll see what I can find.
Jos
On 3 jul. 2017, at 21:20, Takahiro Ueda ***@***.***> wrote:
Here is another spam of valgrind log (vorm) with increasing SortIOSize:
FORM 4.1 (Jul 3 2017, v4.1-20131025-383-gd8ae7a6-dirty) 64-bits Run: Mon Jul 3 21:05:02 2017
#:SortIOSize 10M
#:MaxTermSize 600
#:SubTermsInSmall 16
#:SubLargePatches 1
#:SubFilePatches 2
S x;
CF f;
#define NTERMS "65"
L F = f(<x^1>+...+<x^`NTERMS'>);
P;
.end
StageSort
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=3 file->POsize=298800]
[PutIn: file->handle=4 file->POsize=10000000]
==5619== Syscall param read(buf) points to unaddressable byte(s)
==5619== at 0x32E12DB670: __read_nocancel (in /lib64/libc-2.12.so)
==5619== by 0x50E343: Uread (unixfile.c:134)
==5619== by 0x4FE08C: ReadFile (tools.c:1158)
==5619== by 0x42B0B6: FillInputGZIP (compress.c:694)
==5619== by 0x4DDD98: PutIn (sort.c:1260)
==5619== by 0x4E1AA0: MergePatches (sort.c:3656)
==5619== by 0x4E391C: EndSort (sort.c:1066)
==5619== by 0x4BC6EA: InFunction (proces.c:2057)
==5619== by 0x4B8007: Generator (proces.c:3759)
==5619== by 0x4B8463: Generator (proces.c:3931)
==5619== by 0x4B9BE3: Processor (proces.c:404)
==5619== by 0x43762D: DoExecute (execute.c:838)
==5619== Address 0x15469408 is 0 bytes after a block of size 5,100,488 alloc'd
==5619== at 0x4A05A57: malloc (vg_replace_malloc.c:299)
==5619== by 0x4FF227: Malloc1 (tools.c:2236)
==5619== by 0x4DB0B4: AllocSort (setfile.c:901)
==5619== by 0x4DDBF0: NewSort (sort.c:619)
==5619== by 0x4BC64C: InFunction (proces.c:2033)
==5619== by 0x4B8007: Generator (proces.c:3759)
==5619== by 0x4B8463: Generator (proces.c:3931)
==5619== by 0x4B9BE3: Processor (proces.c:404)
==5619== by 0x43762D: DoExecute (execute.c:838)
==5619== by 0x44DAAA: ExecModule (module.c:274)
==5619== by 0x4AFB2D: PreProcessor (pre.c:962)
==5619== by 0x4E8747: main (startup.c:1605)
==5619==
[PutIn: file->handle=4 file->POsize=10000000]
It is very strange that PutIn() is called with file->POsize=10000000, i.e., SortIOSize. Then ReadFile() overflows from the buffer allocated by AllocSort for the function argument (only 5100488 bytes, valgrind says). GDB shows it is allocated with AllocSort (LargeSize=4000000, SmallSize=500000, SmallEsize=800000, TermsInSmall=16, MaxPatches=1, MaxFpatches=4, IOsize=32768). For TFORM, instead of SortIOSize, the value calculated from AM.S0->file.POsize is used (see threads.c:541 <https://github.com/vermaseren/form/blob/d8ae7a65e86d13024332389730a5abe790be83e8/sources/threads.c#L541-L547>).
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub <#211 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AFLxEtTYxpUTKU9_4ZYMnVwWj82FZLSgks5sKT7tgaJpZM4OKqxS>.
On 8 Apr 2024, at 17:25, jodavies ***@***.***> wrote:
Without seeing the whole terms I can't tell what the d_ are going to end up contracting with etc, so I it seems unlikely that your crash can be reproduced without more information.
To continue investigating, I would add a print before the crashing module and simply re-run the code with the same threads/memory settings etc. Then you can see if you can reproduce the crash yourself, and at the same time we can see what the expression looks like exactly.
—
Reply to this email directly, view it on GitHub <#211 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJPCEQMA72C4IYOOY64NMLY4KZFFAVCNFSM4DRKVRJKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGMYDIOBXHA4A>.
You are receiving this because you modified the open/close state.
It is for the investigation. I have two methods:
1: B tenredgg;
Print;
.sort
id tenredgg(?mu) = dd_(?mu);
2: This is for when the crash occurs before the final sort:
Print "%t”;
id tenredgg(?mu) = dd_(?mu);
This last one would give the offending term as the last term printed.
If tenredgg occurs more than once in some terms, the best would be to do just
one of them and then sort, and then one again etc.
So I got to the printout but not yet to the crash. Here is an example term: outside the brackets we have tenredgg[mu1,mu2], and within the brackets one of the terms is 2/( - 1 + D)*Etens[p2,mu2]* Etens[p2,nu97]*Etens[p1,mu1]*Etens[p1,nu99]*Mom[p2,nu2]*Mom[p1,nu1]^2 *Mom[p1,nu2]*Mom[p1,nu97]*Mom[p1,nu99]*Mom[p1,mudotp1]^2*Mom[p1, mudotp2]^2*prop[k1,0]^4*den[4,2]*(k1.k1)^2*sSS^10*D*kappa^2*mh^(-6)
Of course the more problematic terms are those where tenredgg has many indices, but I can't seem to scroll far enough to get to those... The idea should be the same; each index appears exactly twice in either tenredgg, Mom, or Evect. There are always 4 powers of Evect but the powers of Mom vary.
'Mom[p2,nu2]' is really just a way to write p2[nu2], chosen specifically to avoid having the vector contract automatically.
Ok, I found an example term with sixteen indices in tenredgg (in the printout before the module): tenredgg[mu1,mu2,mu4,nu1,nu99,mudotp1,mudotp2,mudotp3,mudotp4,mudotp5 ,mudotp6,mudotp7,mudotp8,mudotp9,mudotp10,mudotp11] * ( 16384/( - 1 + D) /( - 1 + D)*Etens[p2,mu2]*Etens[p2,mu4]*Etens[p1,mu1]*Etens[p1,nu99]* Mom[p1,nu1]*Mom[p1,mudotp1]*Mom[p1,mudotp2]*Mom[p1,mudotp3]*Mom[p1, mudotp4]*Mom[p1,mudotp5]*Mom[p1,mudotp6]*Mom[p1,mudotp7]*Mom[p1, mudotp8]*Mom[p1,mudotp9]*Mom[p1,mudotp10]*Mom[p1,mudotp11]*prop[k1,0] ^13*den[92897280,169906176]*(k1.k1)^11*sSS^12*kappa^2*mh^(-8) +...)
The code has been running for 17.5 hours now and has neither crashed nor finished the module.
If you resolve the Mom into actual scalar products where you have repeated indices you will get a much smaller result, but I don't know what the rest of your code does and it is not really relevant to the fact that you got the crash.
I imagine this is not going to be easily reproducible. Possibly with a larger portion of your input expression and artificially small buffer settings or something like that.
Another thing that may influence the running:
You have 1/(-1+D). This denominator treatment is notoriously weak and it is better to define your own
denominator function as in
CF Den;
and then use Den(-1+D).
That way it is also easier to have statements like
repeat id D*Den(-1+D) = 1+Den(-1+D);
or more general code as you can find in the second and third lecture in
https://www.nikhef.nl/~form/maindir/courses/uam2022/uam2022.html
Although not likely, it is not inconceivable that the error is related to this, because I cannot see what else you
do with these denominators.
On 9 Apr 2024, at 14:23, jodavies ***@***.***> wrote:
If you resolve the Mom into actual scalar products where you have repeated indices you will get a much smaller result, but I don't know what the rest of your code does and it is not really relevant to the fact that you got the crash.
I imagine this is not going to be easily reproducible. Possibly with a larger portion of your input expression and artificially small buffer settings or something like that.
Do you have the log file from the crashed run?
—
Reply to this email directly, view it on GitHub <#211 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJPCEST3MGLWAMXBYUHBNDY4PMTPAVCNFSM4DRKVRJKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGUYDIOJZGQZQ>.
You are receiving this because you modified the open/close state.
Yes, I agree that the code is absurdly inefficient for my use case. I did not write it and I don't understand the reasons for the authors' choices, so changing things is scary, but it looks like the savings would be worthwhile. The large number of terms is mainly due to the combinatorial explosion of index configurations, which would be avoided if we used either vectors or dummy indices.
I did not save the log file; it did not have much that seemed informative. Just 56,000 StageSort reports from the various threads, followed by the error.
Thank you for the tip about avoiding denominators. But how could the denominator be related to a crash that occurs in the dd_ replacement?
I will add that the error must not be deterministic, since this run has already continued for many more StageSorts than the one that crashed.
Unexpected code in ReNumber
Program terminating in thread 6 at g0828.frm Line 560 -->
Terminate called from reshuf.c:190 (FunLevel)
The module where it stops ends with .sort:split-Vh3-Ch3; (physical line 561); its only statements are two simple substitutions, id Vh3=-l1; and id Ch3=+Kap2;. Elapsed time 8:11, peak RSS 4,719,600 KiB, exit status 1. There was ample free RAM and no OOM event. The input has 1,127 lines plus includes; PolyRatFun is disabled in this module.
Sequential FORM 5.0.1 completes the same programs successfully (3.5–6 hours each). Nine distinct heavy jobs failed under -w10 in the same way (some with signal errors instead of this message); only this original crash log survives.
Could this be related to #211 / #911, or should we file a separate issue with a reduced reproducer? We can try to produce one if useful.
Presumably the patch of #911 does not help here, since you did not receive the Currently Stage 4 sorts are not allowed for function arguments or $ variables termination anyway.
Are you able to share your code (privately by email if you prefer) so that I can try to reproduce the crash locally?
32. Presumably the patch of #911 does not help here, since you did not receive the Currently Stage 4 sorts are not allowed for function arguments or $ variables termination anyway.
Are you able to share your code (privately by email if you prefer) so that I can try to reproduce the crash locally?
Thank you for looking into it. Unfortunately I cannot share the program as is: it includes a private set of model files (the Feynman rules of an unpublished calculation). I am preparing a reduced reproducer instead: the intermediate expression is written with Save right before the failing module, so the test program becomes Load + the two substitutions + the .sort. I will also check how deterministic the crash is (how many runs out of N fail with -w10, and what happens with -w2 and -w4). I will post it here within a day or two; if the saved expression turns out too large for an attachment, I will send a download link or e-mail it, whichever you prefer.
30. Presumably the patch of #911 does not help here, since you did not receive the Currently Stage 4 sorts are not allowed for function arguments or $ variables termination anyway.
Are you able to share your code (privately by email if you prefer) so that I can try to reproduce the crash locally?
@jodavies Thank you for looking into this. I have attached a self-contained, anonymised test package for the intermittent TFORM 5.0.1 “Unexpected code in ReNumber” crash reported above.
The archive contains:
repro_anon.frm: declarations, loading of an intermediate snapshot, and the original modules up to and including the failing one, with user-defined names consistently renamed;
snapA.sav.gz: a snapshot written by sequential FORM 5.0.1, which decompresses to about 113 MB;
run.sh, checksums, and a README documenting the platform, expression sizes, and all 13 subsequent reproduction attempts.
Run ./run.sh 10 for tform -q -w10, or ./run.sh seq for sequential FORM. The threaded run takes about 7–8 minutes and requires approximately 5 GB RAM and 15 GB scratch space on my machine; the sequential run takes about 30 minutes.
Current reproducibility status: the original crash occurred in a module containing only two id substitutions followed by .sort, with three input expressions of 38,639,096 terms each. During the same night, 9 of 19 heavy programs in the same family failed while two TFORM jobs were running concurrently. All nine complete successfully with sequential FORM.
However, none of the 13 subsequent attempts with the original program or reduced variants reproduced the crash, including runs with different worker counts. This package therefore provides a reduced test case, but does not currently trigger the failure reliably. We have not yet tested whether CPU or disk contention affects reproducibility.
Larger snapshots taken immediately before the failing module (3.0 GB and 3.9 GB) are also available if useful. I would be happy to run further tests, including repeated runs or concurrent jobs; please let me know what diagnostics you would like collected. tform_renumber_repro_anon_20261022.tar.gz
FYI: I ran run.sh without any arguments (which runs tform -q -w10) 600 times on a Linux machine using TFORM built from the current master branch (which is indeed the same as v5.0.2). No errors occurred in any of the 600 runs.
Activity
jodavies commentedon Jun 30, 2017
tueda commentedon Jun 30, 2017
It must be an old bug. I got many f's with FORM 4.1 (Oct 25 2013).
vermaseren commentedon Jun 30, 2017
jodavies commentedon Jun 30, 2017
Great, that seems to work.
Now, if I add to the first module:
and to the second module:
form has no problems, but tform -w4 crashes about 60% of the time, with various errors:
EDIT: For this, at some point before the crash, valgrind gives
tueda commentedon Jul 1, 2017
Running
valgrind tvorm -w2forgives me
Now 100% it occurs (though it is not in a worker).
vermaseren commentedon Jul 1, 2017
tueda commentedon Jul 1, 2017
The minimum seems to be 129 terms,
but unfortunately it doesn't crash in spite of the memory bug.
tueda commentedon Jul 1, 2017
Two things:
MaxTermSizeaffects on the appearance of the error (similar to gzip errors #95).In the following log, is
file->POsizeoffile->handle=4OK??The corresponding
vormlog:tueda commentedon Jul 3, 2017
The first example causes memory leaks: https://travis-ci.org/tueda/form/jobs/249641044#L4542. (Should we reopen the issue?)
vermaseren commentedon Jul 3, 2017
tueda commentedon Jul 3, 2017
Here is another spam of valgrind log (vorm) with increasing
SortIOSize:It is very strange that
PutIn()is called withfile->POsize=10000000, i.e.,SortIOSize. ThenReadFile()overflows from the buffer allocated byAllocSortfor the function argument (only 5100488 bytes, valgrind says). GDB shows it is allocated withAllocSort (LargeSize=4000000, SmallSize=500000, SmallEsize=800000, TermsInSmall=16, MaxPatches=1, MaxFpatches=4, IOsize=32768). For TFORM, instead ofSortIOSize, the value calculated fromAM.S0->file.POsizeis used (see threads.c:541).vermaseren commentedon Jul 3, 2017
tueda commentedon Jul 3, 2017
Actually, the problematic
PutIn()is called withAR.FoStage4[0]:24 remaining items
vermaseren commentedon Apr 8, 2024
ahamaline commentedon Apr 8, 2024
vermaseren commentedon Apr 8, 2024
ahamaline commentedon Apr 8, 2024
OK, I'm running it now with the first of those options.
ahamaline commentedon Apr 8, 2024
So I got to the printout but not yet to the crash. Here is an example term: outside the brackets we have
tenredgg[mu1,mu2], and within the brackets one of the terms is2/( - 1 + D)*Etens[p2,mu2]* Etens[p2,nu97]*Etens[p1,mu1]*Etens[p1,nu99]*Mom[p2,nu2]*Mom[p1,nu1]^2 *Mom[p1,nu2]*Mom[p1,nu97]*Mom[p1,nu99]*Mom[p1,mudotp1]^2*Mom[p1, mudotp2]^2*prop[k1,0]^4*den[4,2]*(k1.k1)^2*sSS^10*D*kappa^2*mh^(-6)Of course the more problematic terms are those where tenredgg has many indices, but I can't seem to scroll far enough to get to those... The idea should be the same; each index appears exactly twice in either tenredgg, Mom, or Evect. There are always 4 powers of Evect but the powers of Mom vary.
'Mom[p2,nu2]' is really just a way to write p2[nu2], chosen specifically to avoid having the vector contract automatically.
ahamaline commentedon Apr 9, 2024
Ok, I found an example term with sixteen indices in tenredgg (in the printout before the module):
tenredgg[mu1,mu2,mu4,nu1,nu99,mudotp1,mudotp2,mudotp3,mudotp4,mudotp5 ,mudotp6,mudotp7,mudotp8,mudotp9,mudotp10,mudotp11] * ( 16384/( - 1 + D) /( - 1 + D)*Etens[p2,mu2]*Etens[p2,mu4]*Etens[p1,mu1]*Etens[p1,nu99]* Mom[p1,nu1]*Mom[p1,mudotp1]*Mom[p1,mudotp2]*Mom[p1,mudotp3]*Mom[p1, mudotp4]*Mom[p1,mudotp5]*Mom[p1,mudotp6]*Mom[p1,mudotp7]*Mom[p1, mudotp8]*Mom[p1,mudotp9]*Mom[p1,mudotp10]*Mom[p1,mudotp11]*prop[k1,0] ^13*den[92897280,169906176]*(k1.k1)^11*sSS^12*kappa^2*mh^(-8) +...)The code has been running for 17.5 hours now and has neither crashed nor finished the module.
jodavies commentedon Apr 9, 2024
If you resolve the
Mominto actual scalar products where you have repeated indices you will get a much smaller result, but I don't know what the rest of your code does and it is not really relevant to the fact that you got the crash.I imagine this is not going to be easily reproducible. Possibly with a larger portion of your input expression and artificially small buffer settings or something like that.
Do you have the log file from the crashed run?
vermaseren commentedon Apr 9, 2024
ahamaline commentedon Apr 9, 2024
Yes, I agree that the code is absurdly inefficient for my use case. I did not write it and I don't understand the reasons for the authors' choices, so changing things is scary, but it looks like the savings would be worthwhile. The large number of terms is mainly due to the combinatorial explosion of index configurations, which would be avoided if we used either vectors or dummy indices.
I did not save the log file; it did not have much that seemed informative. Just 56,000 StageSort reports from the various threads, followed by the error.
Thank you for the tip about avoiding denominators. But how could the denominator be related to a crash that occurs in the
dd_replacement?I will add that the error must not be deterministic, since this run has already continued for many more StageSorts than the one that crashed.
jodavies commentedon Jul 17, 2026
I don't know what the status of this one is these days. Related issues were fixed and referenced in #468
teoretik32 commentedon Oct 22, 2026
We observed a TFORM-specific failure while processing a large symbolic expression.
Banner:
TFORM 5.0.1 (Jun 24 2026, v5.0.1), command:tform -q -w10 g0828.frm.The module where it stops ends with
.sort:split-Vh3-Ch3;(physical line 561); its only statements are two simple substitutions,id Vh3=-l1;andid Ch3=+Kap2;. Elapsed time 8:11, peak RSS 4,719,600 KiB, exit status 1. There was ample free RAM and no OOM event. The input has 1,127 lines plus includes;PolyRatFunis disabled in this module.Sequential FORM 5.0.1 completes the same programs successfully (3.5–6 hours each). Nine distinct heavy jobs failed under
-w10in the same way (some with signal errors instead of this message); only this original crash log survives.Could this be related to #211 / #911, or should we file a separate issue with a reduced reproducer? We can try to produce one if useful.
jodavies commentedon Oct 22, 2026
Presumably the patch of #911 does not help here, since you did not receive the
Currently Stage 4 sorts are not allowed for function arguments or $ variablestermination anyway.Are you able to share your code (privately by email if you prefer) so that I can try to reproduce the crash locally?
teoretik32 commentedon Oct 22, 2026
Thank you for looking into it. Unfortunately I cannot share the program as is: it includes a private set of model files (the Feynman rules of an unpublished calculation). I am preparing a reduced reproducer instead: the intermediate expression is written with Save right before the failing module, so the test program becomes Load + the two substitutions + the .sort. I will also check how deterministic the crash is (how many runs out of N fail with -w10, and what happens with -w2 and -w4). I will post it here within a day or two; if the saved expression turns out too large for an attachment, I will send a download link or e-mail it, whichever you prefer.
teoretik32 commentedon Oct 23, 2026
@jodavies Thank you for looking into this. I have attached a self-contained, anonymised test package for the intermittent TFORM 5.0.1 “Unexpected code in ReNumber” crash reported above.
The archive contains:
repro_anon.frm: declarations, loading of an intermediate snapshot, and the original modules up to and including the failing one, with user-defined names consistently renamed;snapA.sav.gz: a snapshot written by sequential FORM 5.0.1, which decompresses to about 113 MB;run.sh, checksums, and a README documenting the platform, expression sizes, and all 13 subsequent reproduction attempts.Run
./run.sh 10fortform -q -w10, or./run.sh seqfor sequential FORM. The threaded run takes about 7–8 minutes and requires approximately 5 GB RAM and 15 GB scratch space on my machine; the sequential run takes about 30 minutes.Current reproducibility status: the original crash occurred in a module containing only two
idsubstitutions followed by.sort, with three input expressions of 38,639,096 terms each. During the same night, 9 of 19 heavy programs in the same family failed while two TFORM jobs were running concurrently. All nine complete successfully with sequential FORM.However, none of the 13 subsequent attempts with the original program or reduced variants reproduced the crash, including runs with different worker counts. This package therefore provides a reduced test case, but does not currently trigger the failure reliably. We have not yet tested whether CPU or disk contention affects reproducibility.
Larger snapshots taken immediately before the failing module (3.0 GB and 3.9 GB) are also available if useful. I would be happy to run further tests, including repeated runs or concurrent jobs; please let me know what diagnostics you would like collected.
tform_renumber_repro_anon_20261022.tar.gz
tueda commentedon Oct 26, 2026
FYI: I ran
run.shwithout any arguments (which runstform -q -w10) 600 times on a Linux machine using TFORM built from the currentmasterbranch (which is indeed the same as v5.0.2). No errors occurred in any of the 600 runs.