René's URL Explorer Experiment


Title: Resource Leak: SMIMESigned constructor leaves background threads hanging on MessagingException · Issue #2245 · bcgit/bc-java · GitHub

Open Graph Title: Resource Leak: SMIMESigned constructor leaves background threads hanging on MessagingException · Issue #2245 · bcgit/bc-java

X Title: Resource Leak: SMIMESigned constructor leaves background threads hanging on MessagingException · Issue #2245 · bcgit/bc-java

Description: Hi team, Description When initializing an SMIMESigned object with a MimeMessage (or MimeBodyPart), Bouncy Castle internalizes the message's content by calling getInputStream(). In many JavaMail configurations (especially with complex nes...

Open Graph Description: Hi team, Description When initializing an SMIMESigned object with a MimeMessage (or MimeBodyPart), Bouncy Castle internalizes the message's content by calling getInputStream(). In many JavaMail con...

X Description: Hi team, Description When initializing an SMIMESigned object with a MimeMessage (or MimeBodyPart), Bouncy Castle internalizes the message's content by calling getInputStream(). In many JavaMail...

Opengraph URL: https://github.com/bcgit/bc-java/issues/2245

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Resource Leak: SMIMESigned constructor leaves background threads hanging on MessagingException","articleBody":"Hi team,\n\n**Description**\nWhen initializing an SMIMESigned object with a MimeMessage (or MimeBodyPart), Bouncy Castle internalizes the message's content by calling getInputStream().\n\nIn many JavaMail configurations (especially with complex nested MimeMultipart objects), getInputStream() returns a PipedInputStream. This implementation spawns a background \"producer\" thread (often named DataHandler.getInputStream) to pump data into the pipe.\n\nIf the MimeMessage is malformed or not a valid S/MIME signed message, the SMIMESigned constructor throws a MessagingException or CMSException. However, if the input stream has already been opened, it is not explicitly closed in a finally block. Because the stream remains open but is no longer being read by the now-defunct SMIMESigned instance, the producer thread stays in a Running state indefinitely, leading to a thread leak.\n\n**Steps to Reproduce**\n1. Create a MimeMessage that is not a valid S/MIME signed message (e.g., a standard multipart/mixed message).\n1. Pass this message to the SMIMESigned constructor.\n1. Catch the resulting exception.\n1. Observe the JVM thread count or use a debugger to see that the DataHandler.getInputStream thread remains active.\n\nHere is a small java class to reproduce the issue:\n[PipedStreamThreadStuckTest.java](https://github.com/user-attachments/files/24942066/PipedStreamThreadStuckTest.java)\n\nAnd here are the threads before SMIMESigned throw exception:\n\u003cimg width=\"424\" height=\"134\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/1695698b-6543-41ed-ba44-50a1205ac3a7\" />\n\n And after **Thread [DataHandler.getInputStream]** is stuck in Running state after the SMIMESigned constructor failed:\n\u003cimg width=\"443\" height=\"174\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/10fac1b4-2ca3-4c85-a7b1-91285b717e89\" />\n\n**Impact**\nIn high-volume mail processing applications, this results in a gradual exhaustion of the thread pool, eventually leading to OutOfMemoryError or application instability.\n\n**Suggested Fix**\nIn the SMIMESigned (and potentially SMIMEMailCap) constructors, ensure that any InputStream obtained from a MimePart is wrapped in a try-finally block or handled such that close() is called if the parsing fails.\n\nThank you for your help!\n","author":{"url":"https://github.com/marijusGood","@type":"Person","name":"marijusGood"},"datePublished":"2026-01-29T15:55:25Z","url":"https://github.com/bcgit/bc-java/issues/2245"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:29d1e4c8-42d2-913e-8493-6b1bc6cd4e8b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE87C:5743C:19F109:244241:6AFBEF39
html-safe-nonce264f4fec2b8881e0f90b72fc752d9ed9987979276154b51dcf7113a6bee54ae3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODdDOjU3NDNDOjE5RjEwOToyNDQyNDE6NkFGQkVGMzkiLCJ2aXNpdG9yX2lkIjoiMzkyNzM4MDEwNzk5NTExNTMyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd9027bfe9c92407793b3f0773418787b1abbbda174c2cf4373d1fc2d7ff1acff
hovercard-subject-tagissue:3871391474
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bcgit/bc-java/2245/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d879541276b0b5d3eddb3d10beff8f972a4cf3df7182715416cfbce93c87d80d/bcgit/bc-java/issues/2245
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d879541276b0b5d3eddb3d10beff8f972a4cf3df7182715416cfbce93c87d80d/bcgit/bc-java/issues/2245
og:image:altHi team, Description When initializing an SMIMESigned object with a MimeMessage (or MimeBodyPart), Bouncy Castle internalizes the message's content by calling getInputStream(). In many JavaMail con...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemarijusGood
hostnamegithub.com
expected-hostnamegithub.com
Nonefa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f
turbo-cache-controlno-preview
go-importgithub.com/bcgit/bc-java git https://github.com/bcgit/bc-java.git
octolytics-dimension-user_id4566970
octolytics-dimension-user_loginbcgit
octolytics-dimension-repository_id10416648
octolytics-dimension-repository_nwobcgit/bc-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id10416648
octolytics-dimension-repository_network_root_nwobcgit/bc-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb3b5633a74535d9c23385512d534c66c8fde1907
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/bcgit/bc-java/issues/2245#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbcgit%2Fbc-java%2Fissues%2F2245
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbcgit%2Fbc-java%2Fissues%2F2245
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=bcgit%2Fbc-java
Reloadhttps://github.com/bcgit/bc-java/issues/2245
Reloadhttps://github.com/bcgit/bc-java/issues/2245
Reloadhttps://github.com/bcgit/bc-java/issues/2245
bcgithttps://github.com/bcgit
bc-javahttps://github.com/bcgit/bc-java
Codehttps://github.com/bcgit/bc-java
Issues47 (47)https://github.com/bcgit/bc-java/issues
Pull requests18 (18)https://github.com/bcgit/bc-java/pulls
Discussionshttps://github.com/bcgit/bc-java/discussions
Actionshttps://github.com/bcgit/bc-java/actions
Projectshttps://github.com/bcgit/bc-java/projects
Wikihttps://github.com/bcgit/bc-java/wiki
Security and qualityhttps://github.com/bcgit/bc-java/security
Insightshttps://github.com/bcgit/bc-java/pulse
https://github.com/bcgit/bc-java
New issuehttps://github.com/login?return_to=https://github.com/bcgit/bc-java/issues/2245
New issuehttps://github.com/login?return_to=https://github.com/bcgit/bc-java/issues/2245
Resource Leak: SMIMESigned constructor leaves background threads hanging on MessagingExceptionhttps://github.com/bcgit/bc-java/issues/2245#top
bugSomething isn't workinghttps://github.com/bcgit/bc-java/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/marijusGood
marijusGoodhttps://github.com/marijusGood
on Jan 29, 2026https://github.com/bcgit/bc-java/issues/2245#issue-3871391474
PipedStreamThreadStuckTest.javahttps://github.com/user-attachments/files/24942066/PipedStreamThreadStuckTest.java
https://private-user-images.githubusercontent.com/60350547/542296201-1695698b-6543-41ed-ba44-50a1205ac3a7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTQ4OTU5NzMsIm5iZiI6MTc5NDg5NTY3MywicGF0aCI6Ii82MDM1MDU0Ny81NDIyOTYyMDEtMTY5NTY5OGItNjU0My00MWVkLWJhNDQtNTBhMTIwNWFjM2E3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTE3VDA2MDc1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg3MGUxYTZiMjA4ODBhMjNiM2I5Nzg2ZjJhZGY4OWI5YTkyODVhYTViZGI0ZGE1NTUxOGE2NzdhZTU0Nzk2NmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.rWjDzsPMjvbJ3bf3WApiPKLUXx_6He-mzbrF9pa60MI
https://private-user-images.githubusercontent.com/60350547/542296515-10fac1b4-2ca3-4c85-a7b1-91285b717e89.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTQ4OTU5NzMsIm5iZiI6MTc5NDg5NTY3MywicGF0aCI6Ii82MDM1MDU0Ny81NDIyOTY1MTUtMTBmYWMxYjQtMmNhMy00Yzg1LWE3YjEtOTEyODViNzE3ZTg5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTE3VDA2MDc1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI2YmQ5ZmFjYzFiNGFiZDhmMGJjNDQ2NmM2NjgyZDQ5YjU4NTM2ODI2NzU5ZmFkMjVhNGNkN2RlMzM0MWYyY2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.sctYRJK_VzdE_JdBF-KrBE2IcxMYVAp_6yCI2fzkCEM
marijusGoodhttps://github.com/marijusGood
on Feb 3, 2026https://github.com/bcgit/bc-java/issues/2245#event-22502572856
fixing piped input stream with getSafeInstance bcgit#2245https://github.com/marijusGood/bc-java/commit/6945fa805b3c6ad9aee11b9aa24f6464135844fb
bcgit#2245https://github.com/bcgit/bc-java/issues/2245
6945fa8https://github.com/marijusGood/bc-java/commit/6945fa805b3c6ad9aee11b9aa24f6464135844fb
updated test class bcgit#2245https://github.com/marijusGood/bc-java/commit/730e3949f5e7fceb254a7cbfb7324c59614c829c
bcgit#2245https://github.com/bcgit/bc-java/issues/2245
730e394https://github.com/marijusGood/bc-java/commit/730e3949f5e7fceb254a7cbfb7324c59614c829c
https://github.com/marijusGood
marijusGoodhttps://github.com/marijusGood
on Mar 4, 2026https://github.com/bcgit/bc-java/issues/2245#issuecomment-3998722004
PipedStreamThreadStuckTest.javahttps://github.com/user-attachments/files/25746061/PipedStreamThreadStuckTest.java
marijusGoodhttps://github.com/marijusGood
on Mar 9, 2026https://github.com/bcgit/bc-java/issues/2245#event-23394441678
updated unit tests to track if the piped thread is stuck bcgit#2245https://github.com/marijusGood/bc-java/commit/d275858f2c3f4f9c82942e5f6b583480077cf11a
bcgit#2245https://github.com/bcgit/bc-java/issues/2245
d275858https://github.com/marijusGood/bc-java/commit/d275858f2c3f4f9c82942e5f6b583480077cf11a
read whole stream to prevent piped thread stuck bcgit#2245https://github.com/marijusGood/bc-java/commit/dc129262a529951cc28c993993618ef1ab2d96ed
bcgit#2245https://github.com/bcgit/bc-java/issues/2245
dc12926https://github.com/marijusGood/bc-java/commit/dc129262a529951cc28c993993618ef1ab2d96ed
fixed styling for java brackets bcgit#2245https://github.com/marijusGood/bc-java/commit/893923698c774d8e6883e85f24e2207a80cade01
bcgit#2245https://github.com/bcgit/bc-java/issues/2245
8939236https://github.com/marijusGood/bc-java/commit/893923698c774d8e6883e85f24e2207a80cade01
https://github.com/marijusGood
marijusGoodhttps://github.com/marijusGood
on Mar 9, 2026https://github.com/bcgit/bc-java/issues/2245#issuecomment-4024858959
https://github.com/dghgit
dghgithttps://github.com/dghgit
on May 17, 2026https://github.com/bcgit/bc-java/issues/2245#issuecomment-4468992287
https://www.bouncycastle.org/betashttps://www.bouncycastle.org/betas
dghgithttps://github.com/dghgit
completedhttps://github.com/bcgit/bc-java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 17, 2026https://github.com/bcgit/bc-java/issues/2245#event-25619083361
winfriedgerlachhttps://github.com/winfriedgerlach
bugSomething isn't workinghttps://github.com/bcgit/bc-java/issues?q=state%3Aopen%20label%3A%22bug%22
on Jul 15, 2026https://github.com/bcgit/bc-java/issues/2245#event-28005521695
codelinaro-mirror-synchttps://github.com/apps/codelinaro-mirror-sync
on Aug 4, 2026https://github.com/bcgit/bc-java/issues/2245#event-28963233795
fixing piped input stream with getSafeInstance bcgit/bc-java#2245https://github.com/CodeLinaro-mirror/la_platform_external_bouncycastle/commit/c5941c7f2ded402ef42292552c0ffb65ee14909c
bcgit/bc-java#2245https://github.com/bcgit/bc-java/issues/2245
c5941c7https://github.com/CodeLinaro-mirror/la_platform_external_bouncycastle/commit/c5941c7f2ded402ef42292552c0ffb65ee14909c
Sign up for freehttps://github.com/signup?return_to=https://github.com/bcgit/bc-java/issues/2245
Sign in to commenthttps://github.com/login?return_to=https://github.com/bcgit/bc-java/issues/2245
bugSomething isn't workinghttps://github.com/bcgit/bc-java/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.