ruby-bunny: FTBFS due to faulty testcase

Bug #1891842 reported by Sergio Durigan Junior
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ruby-bunny (Debian)
Fix Released
Unknown
ruby-bunny (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

[ This is a duplicate of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968420 ]

I've just noticed that ruby-bunny FTBFS when building using a pristine
schroot on sbuild:

--8<---------------cut here---------------start------------->8---
Waiting for pid file '/tmp/d20200814-17660-k3x0b6/mnesia/bunny.pid' to appear

  ## ## RabbitMQ 3.8.5
  ## ##
  ########## Copyright (c) 2007-2020 VMware, Inc. or its affiliates.
  ###### ##
  ########## Licensed under the MPL 1.1. Website: https://rabbitmq.com

  Doc guides: https://rabbitmq.com/documentation.html
  Support: https://rabbitmq.com/contact.html
  Tutorials: https://rabbitmq.com/getstarted.html
  Monitoring: https://rabbitmq.com/monitoring.html

  Logs: /<email address hidden>
        /tmp/d20200814-17660-k3x0b6/log/bunny@paluero_upgrade.log

  Config file(s): /tmp/d20200814-17660-k3x0b6/rabbitmq.conf

  Starting broker... completed with 4 plugins.
Error: operation wait on node bunny@paluero timed out. Timeout value used: 10000
rake aborted!
command failed: ["/usr/lib/rabbitmq/bin/rabbitmqctl", "wait", "/tmp/d20200814-17660-k3x0b6/mnesia/bunny.pid"]
/<<PKGBUILDDIR>>/debian/ruby-tests.rake:53:in `run'
/<<PKGBUILDDIR>>/debian/ruby-tests.rake:62:in `start_rabbitmq_server'
/<<PKGBUILDDIR>>/debian/ruby-tests.rake:75:in `block in <top (required)>'
/usr/share/rubygems-integration/all/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => default
(See full trace by running task with --trace)
ERROR: Test "ruby2.7" failed. Exiting.
dh_auto_install: error: dh_ruby --install /<<PKGBUILDDIR>>/debian/ruby-bunny returned exit code 1
make[1]: *** [debian/rules:10: override_dh_auto_install] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:6: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--8<---------------cut here---------------end--------------->8---

If we try to build in a container/VM using dpkg-buildpackage and a
non-root user, the error happens even earlier:

--8<---------------cut here---------------start------------->8---
Waiting for pid file '/tmp/d20200814-28938-5mzc2m/mnesia/bunny.pid' to appear
23:47:37.895 [error]

23:47:37.899 [error] BOOT FAILED
BOOT FAILED
23:47:37.899 [error] ===========
===========
23:47:37.900 [error] ERROR: distribution port 25672 in use by rabbit@magical-boa
ERROR: distribution port 25672 in use by rabbit@magical-boa
23:47:37.900 [error]

23:47:38.902 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {dist_port_already_used,25672,"rabbit","magical-boa"} in context start_error
23:47:38.903 [error] CRASH REPORT Process <0.153.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","magical-boa"}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"magical-boa\"}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","magical-boa"}}},{rabbi

Crash dump is being written to: erl_crash.dump...done
Error: operation wait on node bunny@magical-boa timed out. Timeout value used: 10000
rake aborted!
command failed: ["/usr/lib/rabbitmq/bin/rabbitmqctl", "wait", "/tmp/d20200814-28938-5mzc2m/mnesia/bunny.pid"]
/home/sergio/ruby-bunny/debian/ruby-tests.rake:53:in `run'
/home/sergio/ruby-bunny/debian/ruby-tests.rake:62:in `start_rabbitmq_server'
/home/sergio/ruby-bunny/debian/ruby-tests.rake:75:in `block in <top (required)>'
/usr/share/rubygems-integration/all/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => default
(See full trace by running task with --trace)
ERROR: Test "ruby2.7" failed. Exiting.
dh_auto_install: error: dh_ruby --install /home/sergio/ruby-bunny/debian/ruby-bunny returned exit code 1
--8<---------------cut here---------------end--------------->8---

There are a few problems with the testcase:

- As stated above, it can't run under as a non-root user. For example,
  this won't work:

    def start_rabbitmq_server
      fork do
        exec('/usr/lib/rabbitmq/bin/rabbitmq-server')
      end

      pidfile = File.join($tmpdir, 'mnesia', 'bunny.pid')
      run('/usr/lib/rabbitmq/bin/rabbitmqctl', 'wait', pidfile)

      run('./bin/ci/before_build')
    end

- The file "bunny.pid" isn't (always) named like that. Here, for
  example, it's named "bunny@${HOST}.pid". This will break the
  following code:

    pidfile = File.join($tmpdir, 'mnesia', 'bunny.pid')
    run('/usr/lib/rabbitmq/bin/rabbitmqctl', 'wait', pidfile)

- It tries to "pkill epmd", which also won't work when run as non-root.

It seems to me like this test should be executed by autopkgtest, because
the operations listed above would then be able to succeed.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I stumbled upon this failure while analyzing the reason for rabbitmq-server's block on the -proposed queue. By the looks of it, the block and this FTBFS are related.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ruby-bunny - 2.14.4-4

---------------
ruby-bunny (2.14.4-4) unstable; urgency=medium

  * Team upload.

  [ Lucas Kanashiro ]
  * d/ruby-tests.rake: add a reminder to revisit the blacklisted spec file
  * d/control: update the Homepage url, the former does not work

  [ Sergio Durigan Junior ]
  * Adjust test infrastructure to use a customized rabbitmq-server.
    In order to perform our tests, we have to install the rabbitmq-server
    package. This means that when we build the package outside a chroot,
    the systemd service of rabbitmq-server is started automatically. This
    is expected behaviour, but it conflicts with what the setup step of
    our tests does: it tries to start its own instance of rabbitmq-server
    using a customized configuration file.
    In order to overcome this problem, it is possible to start another
    instance of rabbitmq-server listening at a different port. This is
    what this commit does, which ultimately fixes a FTBFS that happens
    when building ruby-bunny outside a chroot. Unfortunately, the
    solution here is a bit hacky and prone to failures, but it works
    reasonably well enough that I think it's safe to adopt it into
    package.
    - d/ruby-tests.rake: Use Socket.gethostname to compose the pidfile
      name.
    - d/rules: On override_dh_auto_install, adjust the local rabbitmq.conf
      file and instruct it to listen on localhost:16688; adjust several
      environment variables needed to properly start rabbitmq-server and
      ruby-bunny at the customized port; adjust the tests inside spec/ and
      make sure they explicitly connect to the rabbitmq-server instance
      running on the customized port. (Closes: #968420) (LP: #1891842)

 -- Sergio Durigan Junior <email address hidden> Thu, 20 Aug 2020 10:55:09 -0400

Changed in ruby-bunny (Ubuntu):
status: New → Fix Released
Changed in ruby-bunny (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.