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

rescue if lavinmq starts with faulty msg_store #865

Merged
merged 5 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lavinmq/amqp/queue/message_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ module LavinMQ
@segments.delete seg
next
end
rescue ex
Log.error { "Closing message store: invalid SchemaVersion in #{path}" }
kickster97 marked this conversation as resolved.
Show resolved Hide resolved
kickster97 marked this conversation as resolved.
Show resolved Hide resolved
close
end
end
file.pos = 4
Expand Down Expand Up @@ -377,7 +380,8 @@ module LavinMQ
rescue ex : IO::EOFError
break
rescue ex : OverflowError | AMQ::Protocol::Error::FrameDecode
raise Error.new(mfile, cause: ex)
Log.error { "Closing message store: Failed to read segment #{seg} at pos #{mfile.pos}, #{ex}" }
kickster97 marked this conversation as resolved.
Show resolved Hide resolved
kickster97 marked this conversation as resolved.
Show resolved Hide resolved
close
end
mfile.pos = 4
mfile.unmap # will be mmap on demand
Expand Down
1 change: 1 addition & 0 deletions src/lavinmq/amqp/queue/queue.cr
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ module LavinMQ::AMQP
expire_msg(sp, :rejected)
end
rescue ex : MessageStore::Error
@log.error(ex) { "Queue closed due to error" }
close
raise ex
kickster97 marked this conversation as resolved.
Show resolved Hide resolved
end
Expand Down
Loading