You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During a release upgrade, the system will send a {system, _, _} message that gen_server (and gen_server2) will respond to by calling sys:handle_system_msg(). sys:handle_system_msg() will then call gen_server2:system_code_change(). After the upgrade happens, the system will call gen_server:system_continue() with the new state value returned by gen_server2:system_code_change(). The gen_server2:system_continue() method expects the state record to be a GS2State record.
What had previously been returned by gen_server2:system_code_change() was [GS2State]. The result is that release upgrade fails with the the exception {badrecord,gs2_state}.
This change fixes upgrade by making gen_server2:system_code_change() return a GS2State record rather than [GS2State].
The error was almost certainly an oversight based on the fact that gen_server doesn't use a state record but instead passes its state around as a list. Consequently, gen_server:system_code_change() returns a list of values. When translating gen_server to gen_server2, this would have been easily overlooked.
In fact, the reason behind the oversight is even simpler than that. The gen_server2 module is part of rabbitmq, which doesn't use releases or release upgrades at all. I cannot say anything about this getting merged into the main rabbitmq source tree, but I'll merge the pull request to this repo once I've decided on how to maintain separate versions without having to manually sync.
In fact, the reason behind the oversight is even simpler than that. The
gen_server2 module is part of rabbitmq, which doesn't use releases or
release upgrades at all. I cannot say anything about this getting merged
into the main rabbitmq source tree, but I'll merge the pull request to this
repo once I've decided on how to maintain separate versions without having
to manually sync.
Reply to this email directly or view it on GitHub: #2 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During a release upgrade, the system will send a {system, _, _} message that gen_server (and gen_server2) will respond to by calling sys:handle_system_msg(). sys:handle_system_msg() will then call gen_server2:system_code_change(). After the upgrade happens, the system will call gen_server:system_continue() with the new state value returned by gen_server2:system_code_change(). The gen_server2:system_continue() method expects the state record to be a GS2State record.
What had previously been returned by gen_server2:system_code_change() was [GS2State]. The result is that release upgrade fails with the the exception {badrecord,gs2_state}.
This change fixes upgrade by making gen_server2:system_code_change() return a GS2State record rather than [GS2State].
The error was almost certainly an oversight based on the fact that gen_server doesn't use a state record but instead passes its state around as a list. Consequently, gen_server:system_code_change() returns a list of values. When translating gen_server to gen_server2, this would have been easily overlooked.