Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tform] reading a bracket may crash with B+ when the expression doesn't fit in the scratch buffer #165

Closed
tueda opened this issue Jan 13, 2017 · 8 comments
Labels
bug Something isn't working

Comments

@tueda
Copy link
Collaborator

tueda commented Jan 13, 2017

Here is a small example that exhibits accessing a bracket in tform may crash with B+, depending on the scratch size. The original program had ~ 1GB expression as the input. Instead, a small scratch size is used in the following:

#:MaxTermSize 200
#:ScratchSize 12800
CF f,g;
S n;
L F = <f(1)>+...+<f(100)>;
multiply <g(1)>+...+<g(100)>;
B+ f;
*B- f;  * <-- (1)
ModuleOption noparallel;
.sort
id g(n?) = F[f(n)];
P;
*ModuleOption noparallel;  * <-- (2)
.end

Running this program with, e.g., tform -w4 easily crashes. Note that enabling line (1) or (2), or increasing ScratchSize to ~ 160000 cures the situation.

@tueda tueda added the bug Something isn't working label Jan 13, 2017
@tueda
Copy link
Collaborator Author

tueda commented Jan 13, 2017

Another way to avoid the bug is: undefine WHOLEBRACKETS in threads.c.

@vermaseren
Copy link
Owner

vermaseren commented Jan 13, 2017 via email

@tueda
Copy link
Collaborator Author

tueda commented Jan 13, 2017

To me, it is not clear why WHOLEBRACKETS leads to a constant AN.Frozen...

@vermaseren
Copy link
Owner

vermaseren commented Jan 13, 2017 via email

@tueda
Copy link
Collaborator Author

tueda commented Jan 13, 2017

Maybe related, maybe a different bug, but if I change the number of terms as

L F = <f(1)>+...+<f(79)>;
multiply <g(1)>+...+<g(16)>;

I can get another flavor of error message

TFORM 4.1 (Dec 24 2016, v4.1-20131025-289-gfa1c759) 64-bits 4 workers  Run: Fri Jan 13 21:03:40 2017
    #:MaxTermSize 200
    #:ScratchSize 12800
    CF f,g;
    S n;
    L F = <f(1)>+...+<f(79)>;
    multiply <g(1)>+...+<g(16)>;
    B+ f;
    *B- f;  * <-- (1)
    ModuleOption noparallel;
    .sort

Time =       0.00 sec    Generated terms =       1264
               F         Terms in output =       1264
                         Bytes used      =      32880
    id g(n?) = F[f(n)];
    P;
    *ModuleOption noparallel;  * <-- (2)
    .end
Error while reading scratch file in GetTerm
Program terminating in thread 1 at 1.frm Line 12 --> 

@vermaseren
Copy link
Owner

vermaseren commented Jan 13, 2017 via email

@tueda
Copy link
Collaborator Author

tueda commented Jan 13, 2017

Thanks! The new version (769f7b5) works also for the 1GB example. (But #162 is not fixed yet.)

@tueda tueda closed this as completed Jan 13, 2017
@vermaseren
Copy link
Owner

vermaseren commented Jan 13, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants