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

dbcontext 并发异常该如何处理 我直接那demo 页面请求改成 api 用jmeter 并发测试出现以下异常 #17

Open
liwendiao123 opened this issue Sep 10, 2019 · 1 comment

Comments

@liwendiao123
Copy link

服务器异常:A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same instance of DbContext, however instance members are not guaranteed to be thread safe. This could also be caused by a nested query being evaluated on the client, if this is the case rewrite the query avoiding nested invocations.

@JeffreySu
Copy link
Contributor

dbcontext是不可以跨线程处理同一个对象的事务的(或者简单理解为不要跨线程使用同一个dbcontext实例,同时进行并发的操作),你看一下是否有这样的问题。

如果一定要跨线程,必须要保持同一时间只有一个线程在使用。

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

No branches or pull requests

2 participants