rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
12.31k stars 3.92k forks source link

Stream member crashes during start when unexpected files are present in the stream directory. #12688

Closed kjnilsson closed 1 week ago

kjnilsson commented 2 weeks ago

Describe the bug

osiris_log:orphaned_segments/1 crashes if unexpected files are present:

2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                  [[<<"UNEXPECTED_FILE">>],[]],
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                  [{file,"src/osiris_log.erl"},{line,1822}]},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                      {osiris_log,maybe_fix_corrupted_files,1,
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                  [{file,"src/osiris_log.erl"},{line,631}]},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                      {osiris_log,init,2,
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                  [{file,"src/osiris_log.erl"},{line,530}]},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                      {osiris_replica,handle_continue,2,
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                      [{file,"src/osiris_replica.erl"},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                       {line,175}]},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                      {gen_server,try_handle_continue,3,
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                  [{file,"gen_server.erl"},{line,1085}]},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                      {gen_server,loop,7,[{file,"gen_server.erl"},{line,995}]},
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                      {proc_lib,init_p_do_apply,3,
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0>                                [{file,"proc_lib.erl"},{line,241}]}]}
2024-11-08 07:18:24.261879+00:00 [error] <0.94299120.0> 

Reproduction steps

  1. add a random file to stream directory
  2. restart stream
  3. ...

Expected behavior

ignore unexpected files

Additional context

No response

michaelklishin commented 2 weeks ago

Part of the solution https://github.com/rabbitmq/osiris/pull/171.

michaelklishin commented 1 week ago

https://github.com/rabbitmq/rabbitmq-server/pull/12704