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

Possible loop in multiple tests #12

Closed
dougburns opened this issue Mar 25, 2023 · 6 comments
Closed

Possible loop in multiple tests #12

dougburns opened this issue Mar 25, 2023 · 6 comments

Comments

@dougburns
Copy link
Contributor

Several tests run for a long time consuming many minutes of CPU.
Without intervention the build eventually times out, so this may be a hard loop.
Killing the problem tests allows the build to complete with failures.

test-canonicalize
test-mbscasestr1
test-mbsstr1
test-unsetenv

@dougburns
Copy link
Contributor Author

dougburns commented Apr 15, 2023

Stack traces:

test-canonicalize

  Traceback:                                                                                                                    
    DSA      Entry       E  Offset  Statement   Load Mod             Program Unit                   Service  Status             
                                                                                                                                
    1        hash_lookup -00000574              *PATHNAM                                                     Call               
    2        seen_file   +0000004A              *PATHNAM                                                     Call               
    3        canonicalize_filename_mode_stk                                                                                     
                         +0000058E              *PATHNAM                                                     Call               
    4        canonicalize_file_name                                                                                             
                         +00000014              *PATHNAM                                                     Call               
    5        main        +000001EE              *PATHNAM                                                     Call               
    6        CELQINIT    +00001ACA              CELQLIB              CELQINIT                       HLE77C0  Call               

test-mbscasestr1

        Traceback:                                                                                                                     
      DSA      Entry       E  Offset  Statement   Load Mod             Program Unit                   Service  Status              
                                                                                                                                   
      1        mbscasestr  +00000A4E              *PATHNAM                                                     Call                
      2        main        +0000055E              *PATHNAM                                                     Call                
      3        CELQINIT    +00001ACA              CELQLIB              CELQINIT                       HLE77C0  Call                

test-mbsstr1

      Traceback:                                                                                                                     
  DSA      Entry       E  Offset  Statement   Load Mod             Program Unit                   Service  Status              
                                                                                                                               
  1        mbsstr      +00000702              *PATHNAM                                                     Call                
  2        main        +00000560              *PATHNAM                                                     Call                
  3        CELQINIT    +00001ACA              CELQLIB              CELQINIT                       HLE77C0  Call                

test-unsetenv

      Traceback:                                                                                                                    
    DSA      Entry       E  Offset  Statement   Load Mod             Program Unit                   Service  Status             
                                                                                                                                
    1        CEL4ENVA    +00000A68              CELQLIB              CEL4ENVA                       HLE77C0  Call               
    2        __setenv_a  +000006F2              CELQLIB                                             UI75815  Call               
    3        __unsetenv_a+0000002A              CELQLIB                                             UI75815  Call               
    4        rpl_unsetenv+000000E6              *PATHNAM                                                     Call               
    5        main        +00000150              *PATHNAM                                                     Call               
    6        CELQINIT    +00001ACA              CELQLIB              CELQINIT                       HLE77C0  Call               

No pattern immediately stands out. I'll generate listings for the modules and dig deeper into each case.

@dougburns
Copy link
Contributor Author

test-canonicalize loops trying to process "/etc/passwd".
The problem is caused by /etc being a symbolic link that starts with a sysplex symbol ($SYSNAME).
canonicalize will need changes to deal with these sysplex symbolic links.
I've added a temporary change to avoid the loop by detecting a sysplex symbol and return an error.
Slightly oddly, this causes the test to pass - the "/etc/passwd" check doesn't fail the test because it doesn't exist on all systems.
I've raised issue #13 to look at a proper fix.

@dougburns
Copy link
Contributor Author

test-mbscasestr1 isn't looping, it just runs very inefficiently.
The problem occurs in the sections with the comment:

/* Check that the asymptotic worst-case complexity is not quadratic.  */

This is supposed to ensure that a complex comparison uses the more efficient Knuth-Morris-Pratt algorithm.
The selection criteria for that function aren't ever met, so the test is slogging its way through the search using the more inefficient brute-force approach.
The fast algorithm isn't used because strnlen is returning an incorrect value for a string length.
This is an issue in zoslib - ibmruntimes/zoslib#18

@dougburns
Copy link
Contributor Author

test-mbsstr1 is almost identical to test-mbscasestr1, so presumably is performing in the same way.
The strnlen fix mentioned above causes test-mbsstr1 to complete in a timely manner too.

@dougburns
Copy link
Contributor Author

test-unsetenv loops because the z/OS implementation of getenv/unsetenv provide inconsistent handling of an envar string that is altered after it has been set.
This same problem has been seen in gettextport (also in the embedded gnulib code).
See: zopencommunity/gettextport#15 and https://github.com/ZOSOpenTools/gettextport/pull/14/files
We'll need to patch the text to prevent the loop until the underlying issue is resolved.

@dougburns
Copy link
Contributor Author

fixed by #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant