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

Definition import at node boot with skip_if_unchanged fails silently on invalid json #8372

Closed
blowfishpro opened this issue May 26, 2023 · 0 comments · Fixed by #8388
Closed
Labels
Milestone

Comments

@blowfishpro
Copy link

blowfishpro commented May 26, 2023

Describe the bug

If definition import at node boot is configured with skip_if_unchanged but the definitions file contains invalid JSON, the node boots successfully without any error message and just doesn't import definitions.

Reproduction steps

  1. Configure RabbitMQ to import definitions at boot
definitions.import_backend = local_filesystem
definitions.local.path = /path/to/definitions.json
definitions.skip_if_unchanged = true
  1. Put some invalid json in the definitions file (/path/to/definitions.json in this case)
  2. Start RabbitMQ

Expected behavior

RabbitMQ exits with an error if the definitions are invalid.

Additional context

Related to #2610 - it looks like #6418 fixed it for the skip_if_unchanged = false case but not the true case

Example log output from this scenario:

2023-05-26 13:47:55.566660-07:00 [debug] <0.494.0> Will use module rabbit_definitions_import_local_filesystem to import definitions (if definition file/directory/source has changed)
2023-05-26 13:47:55.566706-07:00 [debug] <0.494.0> Previously stored hash value of imported definitions: 671379266C60...
2023-05-26 13:47:55.566784-07:00 [debug] <0.494.0> Loading definitions with content hashing enabled, path: /opt/homebrew/etc/rabbitmq/definitions.json, is directory?: false, previous hash value: 671379266C60F23F6AC81411E0CF140AC9FD9ECC32C5E74A5DAE3AA5ADE63C03
2023-05-26 13:47:55.567130-07:00 [debug] <0.494.0> New hash: AF7913B4A8695819C485F0329ECFE3228A384F5D30FC7CAB1E1D4924D9F1A02E
2023-05-26 13:47:55.567143-07:00 [info] <0.494.0> Applying definitions from regular file at /opt/homebrew/etc/rabbitmq/definitions.json
2023-05-26 13:47:55.567159-07:00 [debug] <0.494.0> Will try to load definitions from a local file or directory at '/opt/homebrew/etc/rabbitmq/definitions.json'
2023-05-26 13:47:55.567305-07:00 [info] <0.494.0> Applying definitions from file at '/opt/homebrew/etc/rabbitmq/definitions.json'
2023-05-26 13:47:55.567326-07:00 [info] <0.494.0> Asked to import definitions. Acting user: rmq-internal
2023-05-26 13:47:55.567363-07:00 [debug] <0.494.0> Hash value of imported definitions has changed to 671379266C60...
2023-05-26 13:47:55.567396-07:00 [debug] <0.494.0> Storing global imported definitions content hash, hex value: AF7913B4A8695819C485F0329ECFE3228A384F5D30FC7CAB1E1D4924D9F1A02E
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0> Setting global parameter 'imported_definition_hash_value' to <<175,121,19,180,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                168,105,88,25,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                196,133,240,50,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                158,207,227,34,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                138,56,79,93,48,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                252,124,171,30,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                29,73,36,217,
2023-05-26 13:47:55.567411-07:00 [debug] <0.494.0>                                                                241,160,46>>

RabbitMQ version/platform (although I doubt that matters for this):
RabbitMQ 3.11.15 installed via Homebrew
Mac OS 13.3.1 (a) - Apple M1 processor

michaelklishin added a commit that referenced this issue May 28, 2023
and `definitions.skip_if_unchanged` is set to `true`.

References #2610, #6418.
Closes #8372.
@michaelklishin michaelklishin added this to the 3.11.17 milestone May 28, 2023
mergify bot pushed a commit that referenced this issue May 28, 2023
and `definitions.skip_if_unchanged` is set to `true`.

References #2610, #6418.
Closes #8372.

(cherry picked from commit 0c6f8aa)
mergify bot pushed a commit that referenced this issue May 28, 2023
and `definitions.skip_if_unchanged` is set to `true`.

References #2610, #6418.
Closes #8372.

(cherry picked from commit 0c6f8aa)
(cherry picked from commit 7e7431a)

# Conflicts:
#	deps/rabbit/src/rabbit_definitions.erl
#	deps/rabbit/test/definition_import_SUITE.erl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants