pact_broker: Http 500 from Pact Broker when publishing new Pact file
We just upgraded to Pact Broker 2.0.0 and some of our builds are failing due to publishing new Pact files being broken. I have been trying to narrow in on steps to reproduce but haven’t been able to come up with any yet. Not all builds are impacted and if I try and upload the problematic Pact file to a different Pact Broker it does not fail, so I suspect this is somehow related to state in the database.
We’re trying to delete all the existing Pacts for one of the broken builds (there is over 2500, I had to write a script to do this as I couldn’t find a way to bulk delete). I’ll let you know if that fixes it.
The error logged is:
comparison of PactBroker::Domain::OrderVersions::OrderableVersion with PactBroker::Domain::OrderVersions::OrderableVersion failed (ArgumentError)
Along with this somewhat hard to read stack trace:
ERROR -- : ["/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/domain/order_versions.rb:15:in `sort'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/domain/order_versions.rb:15:in `call'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/domain/version.rb:16:in `after_create'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:2166:in `block (2 levels) in _save'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:1326:in `around_create'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:2153:in `block in _save'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:1326:in `around_save'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:2145:in `_save'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:1767:in `block (2 levels) in save'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:2310:in `block in checked_transaction'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/database/transactions.rb:224:in `_transaction'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/database/transactions.rb:199:in `block in transaction'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/database/connecting.rb:301:in `block in synchronize'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/connection_pool/threaded.rb:107:in `hold'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/database/connecting.rb:301:in `synchronize'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/database/transactions.rb:165:in `transaction'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:2310:in `checked_transaction'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:1767:in `block in save'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:2298:in `checked_save_failure'", "/usr/local/bundle/gems/sequel-4.46.0/lib/sequel/model/base.rb:1767:in `save'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/sequel/plugins/newrelic_instrumentation.rb:29:in `block (2 levels) in wrap_sequel_method'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent.rb:438:in `disable_all_tracing'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/sequel/plugins/newrelic_instrumentation.rb:29:in `block in wrap_sequel_method'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/versions/repository.rb:26:in `create'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/versions/repository.rb:34:in `find_by_pacticipant_id_and_number_or_create'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/tags/service.rb:14:in `create'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/api/resources/tag.rb:23:in `from_json'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/helpers.rb:65:in `accept_helper'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/flow.rb:503:in `p3'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:30:in `block (2 levels) in run'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:50:in `handle_exceptions'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:30:in `block in run'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:28:in `loop'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:28:in `run'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/dispatcher.rb:46:in `block in dispatch'", "/usr/local/bundle/gems/as-notifications-1.0.1/lib/as/notifications.rb:161:in `instrument'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/events.rb:75:in `instrument'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/dispatcher.rb:45:in `dispatch'", "/usr/local/bundle/gems/webmachine-1.4.0/lib/webmachine/adapters/rack.rb:68:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/cascade.rb:33:in `block in call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/cascade.rb:24:in `each'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/cascade.rb:24:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/urlmap.rb:65:in `block in call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `each'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/static.rb:119:in `call'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/rack/hal_browser/redirect.rb:19:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/rack/pact_broker/convert_file_extension_to_accept_header.rb:22:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/static.rb:119:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/rack/pact_broker/add_pact_broker_version_header.rb:14:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call'", "/usr/local/bundle/gems/pact_broker-2.0.0/lib/pact_broker/app.rb:23:in `call'", "/service/config.ru:26:in `call'", "/usr/local/bundle/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/lint.rb:49:in `_call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/lint.rb:37:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/showexceptions.rb:24:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/commonlogger.rb:33:in `call'", "/usr/local/bundle/gems/sinatra-1.4.8/lib/sinatra/base.rb:219:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/chunked.rb:43:in `call'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/content_length.rb:14:in `call'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/connection.rb:86:in `block in pre_process'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/connection.rb:84:in `catch'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/connection.rb:84:in `pre_process'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/connection.rb:53:in `process'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/connection.rb:39:in `receive_data'", "/usr/local/bundle/gems/eventmachine-1.2.3/lib/eventmachine.rb:194:in `run_machine'", "/usr/local/bundle/gems/eventmachine-1.2.3/lib/eventmachine.rb:194:in `run'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/backends/base.rb:73:in `start'", "/usr/local/bundle/gems/thin-1.7.0/lib/thin/server.rb:162:in `start'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/handler/thin.rb:16:in `run'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/server.rb:264:in `start'", "/usr/local/bundle/gems/rack-1.5.5/lib/rack/server.rb:141:in `start'", "/usr/local/bundle/gems/rack-1.5.5/bin/rackup:4:in `<top (required)>'", "/usr/local/bundle/bin/rackup:17:in `load'", "/usr/local/bundle/bin/rackup:17:in `<top (required)>'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `load'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `kernel_load'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:27:in `run'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:332:in `exec'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:20:in `dispatch'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:11:in `start'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:34:in `block in <top (required)>'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'", "/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:26:in `<top (required)>'", "/usr/local/bin/bundle:22:in `load'", "/usr/local/bin/bundle:22:in `<main>'"]
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (11 by maintainers)
Commits related to this issue
- Ensure version numbers that don't conform to the semver2 spec don't cause errors when sorting versions. #103 — committed to pact-foundation/pact_broker by bethesque 7 years ago
It depends on the second argument you pass to SemVer. If you call
SemVer.parse("a", "%d")it will return an0.0.0object with “a” as the metadata. So it can behave the same as Versionomy, It just doesn’t do that by default.