Skip to content

多线程并发使用seata的问题 #6311

Open
@xbox1994

Description

@xbox1994

子线程使用RootContext.bind(xid);绑定了主线程的xid,能让报错时整体回滚。但碰到一个问题:

第一个线程修改一个字段,将数据从A改到B,第二个线程修改相同字段(因为是相同xid,可以获取到全局锁),将数据从B改到C,业务异常回滚,那么第一个线程会回滚失败,因为发现脏数据,此时全局锁就一直不会被释放,数据一直被锁住,业务无法继续下去。

请问下官方大佬,这种场景,除了在业务上避免并发修改相同数据外,还有什么好的解决方案呢?seata有机制可以避免吗?或者是我们用seata的方式不对?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugCategory issues or prs related to bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions