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

Process cannot access file error #1402

Closed
Archeia opened this Issue Dec 1, 2016 · 13 comments

Comments

Projects
None yet
4 participants
@Archeia

Archeia commented Dec 1, 2016

Hello! This is really bothering me and I was wondering if anyone has an idea on how to fix this issue?
2016-12-01_20-50-09

Whenever I save directly in dropbox, like making a new file entirely, it would keep throwing this error. And when I check the folder I see these:
2016-12-01_20-52-29

It's driving me insane and this is something recent. It didn't happen before :(

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Dec 1, 2016

Owner

Hmm, that's an issue with QSaveFile. It's already reported on the Qt bug tracker here:

https://bugreports.qt.io/browse/QTBUG-57299

Until that is fixed, I could add an option to turn off safe writing of files, like they did for TeXstudio.

Owner

bjorn commented Dec 1, 2016

Hmm, that's an issue with QSaveFile. It's already reported on the Qt bug tracker here:

https://bugreports.qt.io/browse/QTBUG-57299

Until that is fixed, I could add an option to turn off safe writing of files, like they did for TeXstudio.

@bjorn bjorn added bug qt issue labels Dec 1, 2016

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Dec 1, 2016

Owner

It's driving me insane and this is something recent. It didn't happen before :(

Do you know since when it is happening? What was the last version that worked? I think I've been using QSaveFile since a while so the bug in Qt may be a regression.

Owner

bjorn commented Dec 1, 2016

It's driving me insane and this is something recent. It didn't happen before :(

Do you know since when it is happening? What was the last version that worked? I think I've been using QSaveFile since a while so the bug in Qt may be a regression.

@Archeia

This comment has been minimized.

Show comment
Hide comment
@Archeia

Archeia Dec 1, 2016

@bjorn It's been a while but I think it's 3 versions back?

Archeia commented Dec 1, 2016

@bjorn It's been a while but I think it's 3 versions back?

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Dec 1, 2016

Owner

It's been a while but I think it's 3 versions back?

Hmm, QSaveFile has been used since at least Tiled 0.13 (the code was there since Tiled 0.10, but only active when compiled against Qt 5, which Tiled 0.13 required). So it may be that this was indeed a regression in Qt at some point.

Owner

bjorn commented Dec 1, 2016

It's been a while but I think it's 3 versions back?

Hmm, QSaveFile has been used since at least Tiled 0.13 (the code was there since Tiled 0.10, but only active when compiled against Qt 5, which Tiled 0.13 required). So it may be that this was indeed a regression in Qt at some point.

@Archeia

This comment has been minimized.

Show comment
Hide comment
@Archeia

Archeia Dec 1, 2016

An option to turn it off would be great! Most of our work is in dropbox because we're working internationally and I can't put it in desktop (the project file and graphics are in DB and updating both so the artist can see it eats so much time ;w;)

Archeia commented Dec 1, 2016

An option to turn it off would be great! Most of our work is in dropbox because we're working internationally and I can't put it in desktop (the project file and graphics are in DB and updating both so the artist can see it eats so much time ;w;)

@Yanrishatum

This comment has been minimized.

Show comment
Hide comment
@Yanrishatum

Yanrishatum Dec 7, 2016

Yep, same issue with saving being impossible while Dropbox active. Temporary option to disable safe writing would be wonderful.

Yanrishatum commented Dec 7, 2016

Yep, same issue with saving being impossible while Dropbox active. Temporary option to disable safe writing would be wonderful.

@Janju76

This comment has been minimized.

Show comment
Hide comment
@Janju76

Janju76 Dec 8, 2016

I guess the problem is that the file isn't properly closed or opened with the wrong flags in tiled. When i leave to program open with the unsaved map, after hours i can save it again without the error message.
http://doc.qt.io/qt-5/qfile.html

Probably somewhere in there:

bool MapDocument::save(const QString &fileName, QString *error)
{
    MapFormat *mapFormat = mWriterFormat;

    TmxMapFormat tmxMapFormat;
    if (!mapFormat)
        mapFormat = &tmxMapFormat;

    if (!mapFormat->write(map(), fileName)) {
        if (error)
            *error = mapFormat->errorString();
        return false;
    }

    undoStack()->setClean();
    setFileName(fileName);
    mLastSaved = QFileInfo(fileName).lastModified();

    emit saved();
    return true;
}

Janju76 commented Dec 8, 2016

I guess the problem is that the file isn't properly closed or opened with the wrong flags in tiled. When i leave to program open with the unsaved map, after hours i can save it again without the error message.
http://doc.qt.io/qt-5/qfile.html

Probably somewhere in there:

bool MapDocument::save(const QString &fileName, QString *error)
{
    MapFormat *mapFormat = mWriterFormat;

    TmxMapFormat tmxMapFormat;
    if (!mapFormat)
        mapFormat = &tmxMapFormat;

    if (!mapFormat->write(map(), fileName)) {
        if (error)
            *error = mapFormat->errorString();
        return false;
    }

    undoStack()->setClean();
    setFileName(fileName);
    mLastSaved = QFileInfo(fileName).lastModified();

    emit saved();
    return true;
}
@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Dec 8, 2016

Owner

@jan-jue I don't think the problem is in Tiled. Note that other applications that have switched from QFile to QSaveFile are affected as well. The code you quoted does not keep any file open and no special flags are being used by Tiled (but may be inside QSaveFile).

Owner

bjorn commented Dec 8, 2016

@jan-jue I don't think the problem is in Tiled. Note that other applications that have switched from QFile to QSaveFile are affected as well. The code you quoted does not keep any file open and no special flags are being used by Tiled (but may be inside QSaveFile).

@Archeia

This comment has been minimized.

Show comment
Hide comment
@Archeia

Archeia Dec 27, 2016

Bumping this up!
The issue no longer happens when I 'save'. However, if I try Save As, the bug reappears.

Or not, the bug returned :(

Archeia commented Dec 27, 2016

Bumping this up!
The issue no longer happens when I 'save'. However, if I try Save As, the bug reappears.

Or not, the bug returned :(

@bjorn bjorn added the urgent label Jan 2, 2017

@bjorn bjorn closed this in 8276633 Jan 3, 2017

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jan 3, 2017

Owner

The issue no longer happens when I 'save'. However, if I try Save As, the bug reappears.

Or not, the bug returned :(

Since it is the result of two processes trying to do stuff with the same file in a very short timeframe, I guess it is normal that sometimes it will work. In any case, the snapshot builds will soon feature the option to turn the safe writing of files off.

I hope the option can be removed again once the bug has been fixed in Qt.

Owner

bjorn commented Jan 3, 2017

The issue no longer happens when I 'save'. However, if I try Save As, the bug reappears.

Or not, the bug returned :(

Since it is the result of two processes trying to do stuff with the same file in a very short timeframe, I guess it is normal that sometimes it will work. In any case, the snapshot builds will soon feature the option to turn the safe writing of files off.

I hope the option can be removed again once the bug has been fixed in Qt.

@Janju76

This comment has been minimized.

Show comment
Hide comment
@Janju76

Janju76 Jan 17, 2017

I could reproduce how to to avoiding this problem in 0.18.0 @bjorn!

I always have two tmx files open now in the same editor. When the error message pops up, i am closing the message box, then switch the focus to the other open map, and press save. Then i switch focus back to the map i currently want to save. Then the save is possible without problem.

Janju76 commented Jan 17, 2017

I could reproduce how to to avoiding this problem in 0.18.0 @bjorn!

I always have two tmx files open now in the same editor. When the error message pops up, i am closing the message box, then switch the focus to the other open map, and press save. Then i switch focus back to the map i currently want to save. Then the save is possible without problem.

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jan 17, 2017

Owner

@jan-jue That's an interesting workaround, but I don't think it'll help us doing a reliable fix for this. Did you or @Archeia try whether the new option also avoids the issue?

The only downside to the option is that it may cause data loss if an error happens while writing the map (including out of disk space), but for Dropbox folders this doesn't matter since I believe Dropbox stores older revisions, right? Also it generally won't matter when your file is in version control.

Owner

bjorn commented Jan 17, 2017

@jan-jue That's an interesting workaround, but I don't think it'll help us doing a reliable fix for this. Did you or @Archeia try whether the new option also avoids the issue?

The only downside to the option is that it may cause data loss if an error happens while writing the map (including out of disk space), but for Dropbox folders this doesn't matter since I believe Dropbox stores older revisions, right? Also it generally won't matter when your file is in version control.

@Janju76

This comment has been minimized.

Show comment
Hide comment
@Janju76

Janju76 Jan 17, 2017

@Archeia Please try my workarround and tell me if it works for you.

Janju76 commented Jan 17, 2017

@Archeia Please try my workarround and tell me if it works for you.

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