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

SQL because it is being used by another process #1253

Open
dorathoto opened this issue Sep 27, 2024 · 8 comments
Open

SQL because it is being used by another process #1253

dorathoto opened this issue Sep 27, 2024 · 8 comments

Comments

@dorathoto
Copy link

I have a console program that will perform a Sync when it receives a signalR, but it says that the database is already open.

Yes, I use EntityFramework in my console project..

Dotmim.Sync.SyncException: '[InternalApplyChangesAsync]..[InternalApplyCleanErrorsAsync]..The process cannot access the file 'C:\Users....\dbo_Agendamentos_0000_SQLLocalTotem_ERRORS_rjc0yplu_f2y.json' because it is being used by another process.'

What should I do? Would just closing the connection first work?
use the SqlSyncChangeTrackingProvider()

@Mimetis
Copy link
Owner

Mimetis commented Sep 27, 2024

That's strange.
Are you able to produce a small example that can reproduce the bug ?

Seems you have a problem on accessing a file on disk, and not really the database

That's weird coz this file (indeed generated by DMS) is only used by DMS, internally...

@abri-damien
Copy link

I'm getting the exact same error and its happening here on line 866

@Mimetis
Copy link
Owner

Mimetis commented Nov 29, 2024

Maybe your antivirus, I don't know, honestly

@abri-damien
Copy link

abri-damien commented Nov 29, 2024

I don't have one. Its only specific to a single database. We have around 40 databases with identical schema and only one of them is getting this error.

@abri-damien
Copy link

If I comment out that File.Delete the error goes away, but I get a completely different one

image

@Mimetis
Copy link
Owner

Mimetis commented Nov 29, 2024

no idea, honestly

@Mimetis
Copy link
Owner

Mimetis commented Nov 29, 2024

@abri-damien
Copy link

abri-damien commented Dec 2, 2024

It seems to only happen after errors have occurred. The first error I am getting is the JsonReaderException. The file is indeed incomplete:

Animal_Movements_0000_ERRORS_mrrcnzkz_bxf.json

The process using the file is my app so somewhere its not being closed properly (I'm not touching these files myself).

image

I am using the ASP.NET Core Web Proxy along with SQL Server Change Tracking. I'll see if I can give you a reproducible sample. I can't post the copies of the databases here publicly but I may be able to send them to you privately.

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

3 participants