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

"openFile: resource busy (file is locked)" when refactoring in place #207

Closed
sinelaw opened this issue Jan 20, 2016 · 8 comments
Closed

Comments

@sinelaw
Copy link

sinelaw commented Jan 20, 2016

I'm running:

hlint --refactor --refactor-options="-i"  bla.hs

and I'm consistently getting:

refactor: bla.hs: openFile: resource busy (file is locked)

Does hlint close the file before handing it over to refactor?

@ndmitchell
Copy link
Owner

I can't reproduce this, but I was indeed not closing the file properly, so sometimes it could have leaked (would have depended on when GC ran most likely). Can you try again with the git version?

ndmitchell added a commit that referenced this issue Jan 21, 2016
@sinelaw
Copy link
Author

sinelaw commented Jan 21, 2016

Just tried latest master, still happens...

On Thu, Jan 21, 2016 at 4:01 PM, Neil Mitchell [email protected]
wrote:

I can't reproduce this, but I was indeed not closing the file properly, so
sometimes it could have leaked (would have depended on when GC ran most
likely). Can you try again with the git version?


Reply to this email directly or view it on GitHub
#207 (comment).

@ndmitchell
Copy link
Owner

Hmm. What OS/GHC version? Does it happen for all files? What about a simple file foo = concat . map succ?

@sinelaw
Copy link
Author

sinelaw commented Jan 21, 2016

GHC 7.10.3 installed using stack setup
Linux Mint / Ubuntu 14.04

Will do more tests later...

On Thu, Jan 21, 2016 at 4:37 PM, Noam Lewis [email protected] wrote:

Just tried latest master, still happens...

On Thu, Jan 21, 2016 at 4:01 PM, Neil Mitchell [email protected]
wrote:

I can't reproduce this, but I was indeed not closing the file properly,
so sometimes it could have leaked (would have depended on when GC ran most
likely). Can you try again with the git version?


Reply to this email directly or view it on GitHub
#207 (comment).

@ndmitchell
Copy link
Owner

Can you try running just refactor, without involving hlint, by calling refactor with the hlint output separately. I have a suspicion this might be a refactor only bug, cc @mpickering.

@sinelaw
Copy link
Author

sinelaw commented Jan 21, 2016

I tried doing that but couldn't figure out the right way. Do you run:

hlint file.hs | refactor

...or what?

On Thu, Jan 21, 2016 at 4:56 PM, Neil Mitchell [email protected]
wrote:

Can you try running just refactor, without involving hlint, by calling
refactor with the hlint output separately. I have a suspicion this might be
a refactor only bug, cc @mpickering https://github.com/mpickering.


Reply to this email directly or view it on GitHub
#207 (comment).

@ndmitchell
Copy link
Owner

hlint Sample.hs --serialise | refactor Sample.hs -i

(I had to look that up from the source code)

@sinelaw
Copy link
Author

sinelaw commented Jan 24, 2016

Yeah, looks like refactor fails even then. Still getting: openFile: resource busy (file is locked)

Opened issue mpickering/apply-refact#21

@sinelaw sinelaw closed this as completed Jan 24, 2016
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