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

On Windows, temporary file not deleted - leads to warning #101

Closed
btostevepritchard opened this issue Dec 18, 2014 · 4 comments
Closed

On Windows, temporary file not deleted - leads to warning #101

btostevepritchard opened this issue Dec 18, 2014 · 4 comments

Comments

@btostevepritchard
Copy link

When I run ora2pg for a COPY, I get the following message at the end:

WARNING: an error occurs during data export. Please check what's happen.

This happens because a temporary file hasn't been cleaned up.

(Windows 7, perl v5.18.2 built for MSWin32-x64-multi-thread)

Checking the code in Ora2Pg.pm, I found that the unlink of the temporary file on line 7944 was failing because the file was still open. Changing this to...

close($tempfiles[0]->[0]);
unlink($tempfiles[0]->[1]);

...fixes the problem.

@darold
Copy link
Owner

darold commented Dec 18, 2014

Thanks for the report, the issue is now fixed with last commit a52c425.

Best regards,

@btostevepritchard
Copy link
Author

Darold,

Many thanks for the extremely quick response.

One thing I should have asked in my original issue report was why a
temporary file is created in the first place. As far I as I can see,
"tempfiles" is never used - it just gets unlinked at the end. I guess that
some earlier code used a temporary file and that this has now been removed
or replaced.

Would it be worth removing all reference to "tempfiles"? One less thing to
go wrong!

Steve

On 18 December 2014 at 12:39, Darold notifications@github.com wrote:

Thanks for the report, the issue is now fixed with last commit a52c425
a52c425
.

Best regards,


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

Steve Pritchard
Oracle Database Developer

British Trust for Ornithology, The Nunnery, Thetford, Norfolk IP24 2PU, UK
Tel: +44 (0)1842 750050, fax: +44 (0)1842 750030
Registered Charity No 216652 (England & Wales) No SC039193 (Scotland)
Company Limited by Guarantee No 357284 (England & Wales)

@darold
Copy link
Owner

darold commented Dec 19, 2014

Hi,

Ora2Pg always report errors from the Oracle client, this is the way you know if everything is well done and you trust Ora2Pg. During data export in multiprocess mode, you can experience OOM on some BLOB extraction process and there's no error reported to the main Ora2Pg process. This can mislead you that all your data was well exported.

To fix that Ora2Pg now creates a temporary file when a call to the export function is done and removed the file when it leave the function. Like that in case of OOM, the temporary file is still present and the error can be detected by the main process.

I hope I'm clear enough. But I'm agree that on Windows this could be removed/disabled because multiprocess is not supported.

Best regards,

@btostevepritchard
Copy link
Author

Darold,

Yes that makes sense - a clever way of trapping the OOM errors.It just
wasn't obvious from the code.

No problem having it in for Windows as well, now that you've ensured that
temp file is closed.

Steve

On 19 December 2014 at 16:32, Darold notifications@github.com wrote:

Hi,

Ora2Pg always report errors from the Oracle client, this is the way you
know if everything is well done and you trust Ora2Pg. During data export in
multiprocess mode, you can experience OOM on some BLOB extraction process
and there's no error reported to the main Ora2Pg process. This can mislead
you that all your data was well exported.

To fix that Ora2Pg now creates a temporary file when a call to the export
function is done and removed the file when it leave the function. Like that
in case of OOM, the temporary file is still present and the error can be
detected by the main process.

I hope I'm clear enough. But I'm agree that on Windows this could be
removed/disabled because multiprocess is not supported.

Best regards,


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

Steve Pritchard
Oracle Database Developer

British Trust for Ornithology, The Nunnery, Thetford, Norfolk IP24 2PU, UK
Tel: +44 (0)1842 750050, fax: +44 (0)1842 750030
Registered Charity No 216652 (England & Wales) No SC039193 (Scotland)
Company Limited by Guarantee No 357284 (England & Wales)

@darold darold closed this as completed Jan 8, 2015
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