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

Q - bcMail temporary files are created under /tmp directory and not deleted #103

Closed
avnerw1 opened this issue Mar 1, 2020 · 12 comments
Closed
Assignees
Labels

Comments

@avnerw1
Copy link

avnerw1 commented Mar 1, 2020

Hi Philip,

We use as2-lib, I noticed it is also using bcmail library.
When a file is uploaded to the as2 server (on linux), a copy of each uploaded file is created on his “/tmp” directory.
The filename pattern is “bcMail.mime”
It has the same size of the uploaded file.
The file is not deleted after the transfer is completed.

For example, if you upload 200 MB file, both the destination folder and the /tmp directory will have a file with size 200 MB.

The issue is that the /tmp directory is filled up with these files and user is concern about disk space.

I noticed SMimeUtil is generating these temporary files (but doesn’t delete them once processed or deleteOnExit). I also read that deleteOnExit doesn't always work or can cause issues (and in any case, we need the files to be cleaned before the JVM goes down, as the server is running for a long term).

We think a "use then delete-when-finished" approach is better than keeping this backup file forever.
Might it be that you should use SMIMEUtil.toMimeBodyPart(CMSTypedStream, File) instead?

IMHO, the backing file should be disposed of when it's appropriate (something like a DestroyableMimeBodyPart).

Thanks,
Avner

@phax phax self-assigned this Mar 1, 2020
@phax phax added the question label Mar 1, 2020
@phax
Copy link
Owner

phax commented Mar 1, 2020

Thanks for the report.
Are you sure it is SMimeUtil and not SMIMESignedParser?

It seems to be very similiar to http://bouncy-castle.1462172.n4.nabble.com/Increasing-number-of-bcMail-mime-in-tmp-td1468333.html

@phax
Copy link
Owner

phax commented Mar 1, 2020

Ah okay. I see it. In the decryption when using SMIMEUtil.toMimeBodyPart

phax added a commit that referenced this issue Mar 1, 2020
@phax
Copy link
Owner

phax commented Mar 1, 2020

I've created a 4.5.4 SNAPSHOT that should resolve this issue. Can you please check that?
Thanks

@avnerw1
Copy link
Author

avnerw1 commented Mar 1, 2020

Hi Philip,

Many thanks for the fast response!
We will download and test it soon (I'm on vacation tomorrow, but will do this on Tuesday).

Thanks,
Avner

@phax
Copy link
Owner

phax commented Mar 4, 2020

Hi Avner,
did you find time to crosscheck if your issue is now solved?
Thx, Philip

@avnerw1
Copy link
Author

avnerw1 commented Mar 4, 2020

Hi Philip,

Unfortunately not, I apologize for not testing it yet as we had some urgent issues.
We also noticed we need to do some code changes to use 4.5.4 (we are on 4.5.0) as there were some changes.

I will update you once tested.

Regards,
Avner

@phax
Copy link
Owner

phax commented Mar 4, 2020

No worries, take your time.
I was just curious ;)

@phax
Copy link
Owner

phax commented Mar 11, 2020

Hi Avner,
I am about to do a 4.5.4 release - can you confirm that it works for you?
Thanks

@avnerw1
Copy link
Author

avnerw1 commented Mar 11, 2020

Hi Phillip,
I asked the developer to test it tomorrow. Sorry for the delays.
Thanks,
Avner

@phax
Copy link
Owner

phax commented Mar 11, 2020

Thanks for responding so quickly.
I will go ahread with the 4.5.4 release as my tests were all positive but of course I am looking forward to your response as well.

@avnerw1
Copy link
Author

avnerw1 commented Mar 15, 2020

Hi Phillip,

Thank you for your patience.
We have tested 4.5.5 release successfully. The temp files are not created anymore. :)

Thanks for the quick resolution!!

Regards,
Avner

@avnerw1 avnerw1 closed this as completed Mar 15, 2020
@phax
Copy link
Owner

phax commented Mar 15, 2020

Hi Avner,
thanks for confirming that it works :)
Happy AS2 message exchanging.
BR, Philip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants