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

fix: fix crash caused by multi-threaded access #117

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

wangrong1069
Copy link
Contributor

Remove the thread in EventAdaptor and use the main thread timer to dispatch events directly. EventSource_GENL asynchronously calls MountCacher::updateMountPoints to avoid multi-threaded access. Use Q_GLOBAL_STATIC to create a singleton, and do not allow static acquisition.

Log: fix deepin-anything-server crash
Bug: https://pms.uniontech.com/bug-view-264761.html

Remove the thread in `EventAdaptor` and use the main thread timer to
dispatch events directly. `EventSource_GENL` asynchronously calls
`MountCacher::updateMountPoints` to avoid multi-threaded access. Use
`Q_GLOBAL_STATIC` to create a singleton, and do not allow static
acquisition.

Log: fix deepin-anything-server crash
Bug: https://pms.uniontech.com/bug-view-264761.html
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • EventAdaptor::pushEvent函数中,移除了对waitCondition.wakeAll()的调用,可能会导致在事件处理线程中等待事件完成。
  • EventAdaptor::popEvent函数中,移除了对locker变量的使用,可能会导致在多线程环境下出现竞态条件。
  • TaskThread::setData槽函数中,移除了对locker变量的使用,可能会导致在多线程环境下出现竞态条件。
  • TaskThread::run函数中,移除了对handleFunc的调用,可能会导致未处理的初始化状态。
  • TaskThread::setData槽函数中,移除了对actionList的清空操作,可能会导致未处理的内存泄漏。
  • TaskThread::~TaskThread函数中,删除了对handleFuncactionList的删除操作,可能会导致未处理的内存泄漏。
  • MountCacher::getRootsByPoints函数中,移除了对checkCurrentMounts的调用,可能会导致在获取挂载点信息时遗漏更新。
  • MountCacher::getMountPointsByRoot函数中,移除了对checkCurrentMounts的调用,可能会导致在获取挂载点信息时遗漏更新。

是否建议立即修改:

这些修改可能会导致线程安全问题、未处理的初始化状态和内存泄漏。为了保持代码的稳定性和完整性,建议立即进行修改。

Copy link
Contributor

@re2zero re2zero left a comment

Choose a reason for hiding this comment

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

look's good

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: re2zero, wangrong1069

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wangrong1069
Copy link
Contributor Author

/merge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 19, 2024

This pr cannot be merged! (status: unstable)

@wangrong1069
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jul 19, 2024

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 1c6f168 into linuxdeepin:master Jul 19, 2024
17 of 18 checks passed
@wangrong1069 wangrong1069 deleted the fix-multithreaded-crash branch December 25, 2024 01:43
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