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

Hardcoded /tmp files are created #281

Open
nh2 opened this issue Nov 2, 2023 · 1 comment
Open

Hardcoded /tmp files are created #281

nh2 opened this issue Nov 2, 2023 · 1 comment

Comments

@nh2
Copy link

nh2 commented Nov 2, 2023

In

if( serverSocketStreams.size()>1 ) for( unsigned int idx=0 ; idx<serverSocketStreams.size() ; idx++ ) cacheFiles.emplace_back( std::tmpfile() );

cacheFiles.emplace_back( std::tmpfile() )

std::tmpfile is used.

This writes large files to /tmp unoverridably (apparenlty std::tmpfile() ignores the TMPDIR environment variable, unlike std::filesystem_temp_directory_path.
This can lead to out-of-disk conditions, such as #280.

It is also confusing, especially for programs where --tempDir is given, that then another temp directory is additionally used.

Finally, these cacheFiles are never close()d so they leak file descriptors all the way to the end of the process.

nh2 added a commit to nh2/PoissonRecon that referenced this issue Nov 2, 2023
With the switch away from `std::tmpdir()` we lose the
auto-deletion functionality of the temp files.
There's no cross-platform alternative that allows
to specify the temporary dir:
    https://stackoverflow.com/questions/5586355/c-getting-a-temporary-file-cross-platform

The previous approach also had the drawback that the temp
files were kept open, and were not truncated, throughout
all phases, thus potentially using disk space for longer
than necessary.

This commit deletes the temporary files before each new use
(though truncating would be sufficient).
@nh2
Copy link
Author

nh2 commented Nov 2, 2023

I made improvements to this in my branch master...nh2:PoissonRecon:nh2fixes-v15.03

nh2 added a commit to nh2/PoissonRecon that referenced this issue Nov 2, 2023
With the switch away from `std::tmpdir()` we lose the
auto-deletion functionality of the temp files.
There's no cross-platform alternative that allows
to specify the temporary dir:
    https://stackoverflow.com/questions/5586355/c-getting-a-temporary-file-cross-platform

The previous approach also had the drawback that the temp
files were kept open, and were not truncated, throughout
all phases, thus potentially using disk space for longer
than necessary.

This commit deletes the temporary files before each new use
(though truncating would be sufficient).
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

1 participant