Skip to content

Handle file creation and locking for Windows #273

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

Closed
wants to merge 1 commit into from
Closed

Handle file creation and locking for Windows #273

wants to merge 1 commit into from

Conversation

sdegroot
Copy link

Due to the use of the 'defer' keyword, file handles were kept open too long. This resulted in the error 'The process cannot access the file because it is being used by another process.'.

Another addition is for opening the file .logstash-forwarder. Initially this file will not exist. The Registar for Windows assumes this file exists. Therefore we explicitly tell the OS to create the file when it doesn't exist yet.

See also https://groups.google.com/forum/#!topic/logstash-users/oFDcoGj8Qtc

Due to the use of the 'defer' keyword, file handles were kept open too long. This resulted in the error 'The process cannot access the file because it is being used by another process.'.

Another addition is for opening the file .logstash-forwarder. Initially this file will not exist. The Registar for Windows assumes this file exists. Therefore we explicitly tell the OS to create the file when it doesn't exist yet.

See also https://groups.google.com/forum/#!topic/logstash-users/oFDcoGj8Qtc
@sdegroot
Copy link
Author

I'm fairly new to golang so please check everything thoroughly!

@driskell
Copy link
Contributor

The create should be fine to leave out. You remove it in registrar_windows anyway and ignore the error.

Apart from that lolls good, but it duplicates #272

@Tamerz
Copy link

Tamerz commented Feb 2, 2015

This doesn't seem to be included in the master yet. Is there a reason for this? It appears to work for me.

@toebens
Copy link

toebens commented Aug 3, 2015

yes it looks like #273 as well as #487 is a duplicate bug fix. this has been fixed with #272 already.
unfortunately however #272 still hasn't made it in the master branch because the pull request was not accepted. actually i do not get it why it hasn't been accepted...in the meantime...

@ruflin
Copy link

ruflin commented Oct 6, 2015

This should be fixed in filebeat (next version of logstash-forwarder) with https://github.com/elastic/filebeat/pull/43 and https://github.com/elastic/filebeat/pull/45

@ruflin
Copy link

ruflin commented Oct 7, 2015

As the next release of logstash-forwarder will be filebeat, I will close this issue based on the comment above. In case the issue still exists in filebeat, please reopen or open a new issue directly in the filebeat repo.

@ruflin ruflin closed this Oct 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants