Skip to content

test failures caused by Thread trace output #227

@boutil

Description

@boutil

Hi,

When building the package for Debian, the test suite is run. From time to time, a test fails because of the presence of a debug trace, which causes the output to not match the expected result:

Here are two examples of such failures:

Failures:

  1) Parallel.each does not call the finish hook when a start hook fails with threads
     Failure/Error: `METHOD=each WORKER_TYPE=#{type} ruby spec/cases/with_exception_in_start_before_finish.rb 2>&1`.should == '3 called'
     
       expected: "3 called"
            got: "/home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.r... `public_send'\n\tfrom spec/cases/with_exception_in_start_before_finish.rb:21:in `<main>'\n3 called" (using ==)
       Diff:
       @@ -1,2 +1,28 @@
       +/home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `value': No live threads left. Deadlock? (fatal)
       +2 threads, 2 sleeps current:0x000055e6f85ce7c0 main thread:0x000055e6f8243ff0
       +* #<Thread:0x000055e6f8278b68 sleep_forever>
       +   rb_thread_t:0x000055e6f8243ff0 native:0x00007f2e54e99740 int:0
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `value'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `map!'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `in_threads'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:335:in `work_in_threads'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:262:in `map'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:217:in `each'
       +   spec/cases/with_exception_in_start_before_finish.rb:21:in `public_send'
       +   spec/cases/with_exception_in_start_before_finish.rb:21:in `<main>'
       +* #<Thread:0x000055e6f8550610@/home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:206 sleep_forever>
       +   rb_thread_t:0x000055e6f85ce7c0 native:0x00007f2e54572700 int:0
       +    depended by: tb_thread_id:0x000055e6f8243ff0
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:110:in `synchronize'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:110:in `next'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:338:in `block in work_in_threads'
       +   /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:206:in `block (2 levels) in in_threads'
       +        from /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `map!'
       +        from /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `in_threads'
       +        from /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:335:in `work_in_threads'
       +        from /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:262:in `map'
       +        from /home/boutil/debian/ruby-team/ruby-parallel/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:217:in `each'
       +        from spec/cases/with_exception_in_start_before_finish.rb:21:in `public_send'
       +        from spec/cases/with_exception_in_start_before_finish.rb:21:in `<main>'
        3 called
       
     # ./spec/parallel_spec.rb:524:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:8:in `block (2 levels) in <top (required)>'

Finished in 55.06 seconds (files took 0.21319 seconds to load)
120 examples, 1 failure, 9 pending

Failed examples:

rspec ./spec/parallel_spec.rb[1:9:23] # Parallel.each does not call the finish hook when a start hook fails with threads

or

Failures:

  1) Parallel lambdas runs in threads
     Failure/Error: `ruby spec/cases/with_#{thing}.rb THREADS 2>&1`.should == result

       expected: "ITEM-1\nITEM-2\nITEM-3\n"
            got: "/<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/paral...usr/lib/ruby/vendor_ruby/parallel.rb:262:in `map'\n\tfrom spec/cases/with_queue.rb:18:in `<main>'\n" (using ==)
       Diff:
       @@ -1,4 +1,23 @@
       -ITEM-1
       -ITEM-2
       -ITEM-3
       +/<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `value': No live threads left. Deadlock? (fatal)
       +2 threads, 2 sleeps current:0x000056125940cf40 main thread:0x0000561258fd10d0
       +* #<Thread:0x0000561259004b70 sleep_forever>
       +   rb_thread_t:0x0000561258fd10d0 native:0x00007efd2c062740 int:1
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `value'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `map!'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `in_threads'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:335:in `work_in_threads'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:262:in `map'
       +   spec/cases/with_queue.rb:18:in `<main>'
       +* #<Thread:0x00005612592e8508@/<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:206 sleep_forever>
       +   rb_thread_t:0x000056125940cf40 native:0x00007efd2bb39700 int:0
       +    depended by: tb_thread_id:0x0000561258fd10d0
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:102:in `synchronize'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:102:in `next'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:338:in `block in work_in_threads'
       +   /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:206:in `block (2 levels) in in_threads'
       +	from /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `map!'
       +	from /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:207:in `in_threads'
       +	from /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:335:in `work_in_threads'
       +	from /<<PKGBUILDDIR>>/debian/ruby-parallel/usr/lib/ruby/vendor_ruby/parallel.rb:262:in `map'
       +	from spec/cases/with_queue.rb:18:in `<main>'
     # ./spec/parallel_spec.rb:574:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:8:in `block (2 levels) in <top (required)>'

Finished in 47.46 seconds (files took 0.16615 seconds to load)
120 examples, 1 failure, 9 pending

Failed examples:

rspec './spec/parallel_spec.rb[1:13:1]' # Parallel lambdas runs in threads

These traces are certainly not wanted, but maybe the tests should use regexp matches instead of strict equality of strings. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions