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

Windows: Handling git better, not keep files open.. #109

Open
stolsvik opened this issue Mar 20, 2016 · 12 comments
Open

Windows: Handling git better, not keep files open.. #109

stolsvik opened this issue Mar 20, 2016 · 12 comments
Assignees

Comments

@stolsvik
Copy link

I use Glogg as a file viewer on windows, due to its extremely good handling of very large files.

From a Java project, we create some huge "report files" which are checked into git.

However, I do get some problems with git, as glogg evidently (quite obviously, given its "log viewer" main feature) keeps the files open. This works for the Java-task that writes to the file, as it evidently just truncs the file before writing a new report - nicely being caught by Glogg which reloads it instantly.

However, when handling the files with git (e.g. checkout, pull/rebase, whatever), it fails miserably, as git evidently unlinks (deletes) the file before putting in new content. This is not possible when glogg is active - and since I view these files all the time, this becomes a "oh, dang!" moment basically every single time I perform anything with git.

An (optional) feature where it would be possible to let Glogg not hold the file open, while still detecting changes and reloading, would for my use case be very valuable!

@nickbnf
Copy link
Owner

nickbnf commented Nov 26, 2016

Thanks for the report, the only reason why glogg keeps the file open is performance. It is WAY slower to close and reopen the file every time glogg needs to redraw the screen. Interestingly this is what happened before 1.0.3 (see 90684c5 where I did the change and mentioned some perf measurements).
Note this is only a problem on Windows, sensible OSes like Linux or macOS don't care if a file is open when unlinking ("unlink" is actually a UNIX term, Windows deletes as I understand it).
We could add an "advanced" option for Windows to keep the file closed, at the expense of performance.

@wiz0u
Copy link

wiz0u commented Jan 3, 2017

This is a real issue for me as well. My logging system tries to rename or delete the daily log file at the end of the day but if someone is still watching the log file with the latest version of glogg, the file operation fails because the file is kept open by glogg.
We had to revert to glogg 1.0.2 :(

@austinwagner
Copy link

I'd take slower performance over messing up log rotation because I kept a file open. Whatever the performance impact is, I doubt it will make it slower than the only other real competitor I've used: BareTail. Glogg has incredible search performance compared to BareTail which is the main reason why I'm dealing with the files being locked instead of using BareTail like everyone else at my workplace. I hope you consider adding that option to reopen the file on redraw instead of holding it open.

@shvez
Copy link

shvez commented Feb 6, 2018

Windows allows to open file with delete access. one needs to specify FILE_SHARE_DELETE for CreateFile api call.

@austinwagner
Copy link

austinwagner commented Feb 7, 2018 via email

@shvez
Copy link

shvez commented Feb 8, 2018

well, ok.
here is from MS Docs:

The DeleteFile function fails if an application attempts to delete a file that has other handles open for normal I/O or as a memory-mapped file (FILE_SHARE_DELETE must have been specified when other handles were opened).

i do not have time to check it my self, although i do not see any sense to have right for operation which you can not complete anyway.

lets say, flag in settings will be einough.

@bilbothebaggins
Copy link

bilbothebaggins commented Feb 17, 2018

I can confirm from personal dev experience that FILE_SHARE_DELETE allows a file to be deleted (actually "deleted") while handles are open. The problem is, this won't help, because while the OS will honor the delete request once all handles have been closed, while the file is still being held, it's name is still there and not ready for reuse.

@GiuseppeGenga-Neural
Copy link

GiuseppeGenga-Neural commented Mar 9, 2018

Hello @nickbnf, any news on the "don't keep the file open" option? I've got a similar issue with rotating Log4Net logs: if I keep them open in glogg, the rotation doesn't occur as the files are locked. I'll temporarily solve this forcing a glogg process termination on my client machine before the rotation time, but having an option would be great.

@wiz0u
Copy link

wiz0u commented Mar 15, 2018

Please @nickbnf, add this as an option.
Any serious company has a rolling/rotating/archiving log policy, and running instances of glogg preventing logs to be moved are just unacceptable.
This feature is very important for glogg success.

@arushi315
Copy link

Hi @nickbnf Do you have any update on this issue? We are currently facing the similar issue mentioned by @wiz0u, rolling over fails since log file is locked by glogg.

@ssgonell
Copy link

As @wiz0u pointed out, version 1.0.2 has this feature (with some performance degradation though). I have switched to it given the cost benefit for my use case.

Quick link is here: http://glogg.bonnefon.org/files/glogg-v1.0.2-1-setup.exe

@variar
Copy link
Contributor

variar commented Feb 1, 2019

I've implemented @wiz0u suggestion to fix variar#36. Need testing in real-world scenarios bacause my daily job does not involve log-files changing in real time. Latest builds are available from releases.

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

10 participants