Skip to content

fix: Prevent segfault by correctly handling dbus restarts in mender-update and mender-auth#1880

Merged
michalkopczan merged 2 commits into
mendersoftware:masterfrom
michalkopczan:MEN-9144-mender-client-segfaults-upon-dbus-shutdown
Jan 23, 2026
Merged

fix: Prevent segfault by correctly handling dbus restarts in mender-update and mender-auth#1880
michalkopczan merged 2 commits into
mendersoftware:masterfrom
michalkopczan:MEN-9144-mender-client-segfaults-upon-dbus-shutdown

Conversation

@michalkopczan

Copy link
Copy Markdown
Contributor

Ticket: MEN-9144
Changelog: Prevent segfault by correctly handling dbus restarts in mender-update and mender-auth. Previously when systemctl stop dbus.socket or systemctl stop dbus was called, it resulted in mender-update segfault.

No tests, as we would need to create a way to stop dbus, wait for correct time etc. IMO not worth it - too much effort for too little gain.

@mender-test-bot

Copy link
Copy Markdown

@michalkopczan, start a full client pipeline with:

  • mentioning me and start client pipeline

my commands and options

You can prevent me from automatically starting CI pipelines:

  • if your pull request title starts with "[NoCI] ..."

You can trigger a client pipeline on multiple prs with:

  • mentioning me and start client pipeline --pr mender/127 --pr mender-connect/255

You can trigger GitHub->GitLab branch sync with:

  • mentioning me and sync

You can cherry pick to a given branch or branches with:

  • mentioning me and:
 cherry-pick to:
 * 1.0.x
 * 2.0.x

@michalkopczan

Copy link
Copy Markdown
Contributor Author

@mender-test-bot start client pipeline

@mender-test-bot

Copy link
Copy Markdown

Hello 😺 I created a pipeline for you here: Pipeline-2267035160

Build Configuration Matrix

Key Value
BUILD_BEAGLEBONEBLACK true
BUILD_CLIENT true
BUILD_QEMUX86_64_BIOS_GRUB true
BUILD_QEMUX86_64_BIOS_GRUB_GPT true
BUILD_QEMUX86_64_UEFI_GRUB true
BUILD_VEXPRESS_QEMU true
BUILD_VEXPRESS_QEMU_FLASH true
BUILD_VEXPRESS_QEMU_UBOOT_UEFI_GRUB true
INTEGRATION_REV master
MENDER_BINARY_DELTA_REV master
MENDER_CLIENT_SUBCOMPONENTS_REV main
MENDER_CONFIGURE_MODULE_REV master
MENDER_CONNECT_REV master
MENDER_CONTAINER_MODULES_REV main
MENDER_FLASH_REV master
MENDER_REV pull/1880/head
MONITOR_CLIENT_REV master
RUN_INTEGRATION_TESTS true
TEST_QEMUX86_64_BIOS_GRUB true
TEST_QEMUX86_64_BIOS_GRUB_GPT true
TEST_QEMUX86_64_UEFI_GRUB true
TEST_VEXPRESS_QEMU true
TEST_VEXPRESS_QEMU_FLASH true
TEST_VEXPRESS_QEMU_UBOOT_UEFI_GRUB true

@vpodzime vpodzime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for working on this tough code!

Comment thread src/common/platform/dbus/asio_libdbus/dbus.cpp Outdated
Comment thread src/common/platform/dbus/asio_libdbus/dbus.cpp Outdated
Comment thread src/common/platform/dbus/asio_libdbus/dbus.cpp
Comment thread src/mender-update/daemon/states.cpp
@michalkopczan
michalkopczan force-pushed the MEN-9144-mender-client-segfaults-upon-dbus-shutdown branch from b7f17ee to ebfee33 Compare January 21, 2026 13:03

@vpodzime vpodzime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last nitpick. Thanks!

Comment thread src/mender-update/daemon/states.cpp Outdated
if (err != error::NoError) {
log::Error("Error when trying to poll for deployment: " + err.String());
// If we're here, no handler will be called, so we need to manually schedule the next
// deployment poll

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this comment. However, could you please extend it a bit? It's hard to follow why/how doing poster.PostEvent(StateEvent::Failure); from PollForDeploymentState doesn't result in scheduling a next deployment poll. I can see it in the code, but it would be nice to save future me and others from (re-)doing that digging. 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, makes sense! Added.

@michalkopczan
michalkopczan force-pushed the MEN-9144-mender-client-segfaults-upon-dbus-shutdown branch from ebfee33 to cfdde28 Compare January 22, 2026 10:17
@michalkopczan

Copy link
Copy Markdown
Contributor Author

@mender-test-bot start client pipeline

@mender-test-bot

Copy link
Copy Markdown

Hello 😺 I created a pipeline for you here: Pipeline-2278522358

Build Configuration Matrix

Key Value
BUILD_BEAGLEBONEBLACK true
BUILD_CLIENT true
BUILD_QEMUX86_64_BIOS_GRUB true
BUILD_QEMUX86_64_BIOS_GRUB_GPT true
BUILD_QEMUX86_64_UEFI_GRUB true
BUILD_VEXPRESS_QEMU true
BUILD_VEXPRESS_QEMU_FLASH true
BUILD_VEXPRESS_QEMU_UBOOT_UEFI_GRUB true
INTEGRATION_REV master
MENDER_BINARY_DELTA_REV master
MENDER_CLIENT_SUBCOMPONENTS_REV main
MENDER_CONFIGURE_MODULE_REV master
MENDER_CONNECT_REV master
MENDER_CONTAINER_MODULES_REV main
MENDER_FLASH_REV master
MENDER_REV pull/1880/head
MONITOR_CLIENT_REV master
RUN_INTEGRATION_TESTS true
TEST_QEMUX86_64_BIOS_GRUB true
TEST_QEMUX86_64_BIOS_GRUB_GPT true
TEST_QEMUX86_64_UEFI_GRUB true
TEST_VEXPRESS_QEMU true
TEST_VEXPRESS_QEMU_FLASH true
TEST_VEXPRESS_QEMU_UBOOT_UEFI_GRUB true

…pdate and mender-auth

Ticket: MEN-9144
Changelog: Prevent segfault by correctly handling dbus restarts in mender-update and mender-auth.
Previously when systemctl stop dbus.socket or systemctl stop dbus was called, it resulted in mender-update segfault.

Signed-off-by: Michal Kopczan <michal.kopczan@northern.tech>
…g no handler to be called

Ticket: MEN-9144
Changelog: Fix a hang when polling for deployment failed early causing no handler of API response
to be called. Added handler call for this case, causing the deployment polling
to continue.

Signed-off-by: Michal Kopczan <michal.kopczan@northern.tech>
@michalkopczan
michalkopczan force-pushed the MEN-9144-mender-client-segfaults-upon-dbus-shutdown branch from cfdde28 to 6aa4c77 Compare January 23, 2026 11:00
@mender-test-bot

mender-test-bot commented Jan 23, 2026

Copy link
Copy Markdown

Merging these commits will result in the following changelog entries:

Changelogs

mender (MEN-9144-mender-client-segfaults-upon-dbus-shutdown)

New changes in mender since master:

Bug Fixes
  • Fix a hang when polling for deployment failed early causing no handler of API response
    to be called. Added handler call for this case, causing the deployment polling
    to continue.
    (MEN-9144)
  • Prevent segfault by correctly handling dbus restarts in mender-update and mender-auth.
    Previously when systemctl stop dbus.socket or systemctl stop dbus was called, it resulted in mender-update segfault.
    (MEN-9144)

@michalkopczan

Copy link
Copy Markdown
Contributor Author

@mender-test-bot start client pipeline

@mender-test-bot

Copy link
Copy Markdown

Hello 😺 I created a pipeline for you here: Pipeline-2281567760

Build Configuration Matrix

Key Value
BUILD_BEAGLEBONEBLACK true
BUILD_CLIENT true
BUILD_QEMUX86_64_BIOS_GRUB true
BUILD_QEMUX86_64_BIOS_GRUB_GPT true
BUILD_QEMUX86_64_UEFI_GRUB true
BUILD_VEXPRESS_QEMU true
BUILD_VEXPRESS_QEMU_FLASH true
BUILD_VEXPRESS_QEMU_UBOOT_UEFI_GRUB true
INTEGRATION_REV master
MENDER_BINARY_DELTA_REV master
MENDER_CLIENT_SUBCOMPONENTS_REV main
MENDER_CONFIGURE_MODULE_REV master
MENDER_CONNECT_REV master
MENDER_CONTAINER_MODULES_REV main
MENDER_FLASH_REV master
MENDER_REV pull/1880/head
MONITOR_CLIENT_REV master
RUN_INTEGRATION_TESTS true
TEST_QEMUX86_64_BIOS_GRUB true
TEST_QEMUX86_64_BIOS_GRUB_GPT true
TEST_QEMUX86_64_UEFI_GRUB true
TEST_VEXPRESS_QEMU true
TEST_VEXPRESS_QEMU_FLASH true
TEST_VEXPRESS_QEMU_UBOOT_UEFI_GRUB true

@michalkopczan
michalkopczan merged commit 7df5181 into mendersoftware:master Jan 23, 2026
14 checks passed
@mender-test-bot

Copy link
Copy Markdown

Hello 😺 This PR contains changelog entries. Please, verify the need of backporting it to the following release branches:
5.0.x (release 3.8.x) - 🤖 🍒

@michalkopczan

Copy link
Copy Markdown
Contributor Author

@mender-test-bot cherry-pick to:

  • 5.0.x

@mender-test-bot

Copy link
Copy Markdown

Hi 😺
I did my very best, and this is the result of the cherry pick operation:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants