René's URL Explorer Experiment


Title: RotatingFileHandler fails when logs are stored in a non-posix file system docker-mounted in Linux-OS · Issue #120647 · python/cpython · GitHub

Open Graph Title: RotatingFileHandler fails when logs are stored in a non-posix file system docker-mounted in Linux-OS · Issue #120647 · python/cpython

X Title: RotatingFileHandler fails when logs are stored in a non-posix file system docker-mounted in Linux-OS · Issue #120647 · python/cpython

Description: Bug report Bug description: Issue description The RotatingFileHandler fails to execute the method self.shouldRollover() because of an OSError: [Errno 9] Bad file descriptor. Background info: The issue appears in an application running in...

Open Graph Description: Bug report Bug description: Issue description The RotatingFileHandler fails to execute the method self.shouldRollover() because of an OSError: [Errno 9] Bad file descriptor. Background info: The is...

X Description: Bug report Bug description: Issue description The RotatingFileHandler fails to execute the method self.shouldRollover() because of an OSError: [Errno 9] Bad file descriptor. Background info: The is...

Opengraph URL: https://github.com/python/cpython/issues/120647

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RotatingFileHandler fails when logs are stored in a non-posix file system docker-mounted in Linux-OS","articleBody":"# Bug report\n\n### Bug description:\n\n### Issue description\n\nThe `RotatingFileHandler `fails to execute the method `self.shouldRollover()` because of an `OSError: [Errno 9] Bad file descriptor`. \n\nBackground info: The issue appears in an application running in Docker on Debian. I use Windows Server 2016 as my main file server, so I usually want all my logs stored over there.\n\nI really do not want to provide any misleading information but to me, it looks like the issue started appearing with python 3.12.\nI've been using the python logging module for years now within a lot of different projects, all running in docker and always storing the log files over to my Windows file server through this “double mounting” technique (more about this down below).\n\nI started seeing the issues when I first deployed an app with python 3.12. This was a new project, which never ran under previous python versions. However, I have a couple of other projects which shares the same code and the same logging technique but still run previous python versions (nothing ancient, \u003e=3.9). This issue never came up there.\n\nMy guess is that python threats the directory as posix-complient as it detects a Linux-OS, although this is not the case as the directory lives on a NTFS file system on Windows. May this be the case?\n\n**Strange fact 😵**: My app runs 24/7. It runs the whole week no problem, writes a lot of log entries like a charme. But when I come back after the weekend, I find it “stuck” on this error. As if the shouldRollover() method somehow gets called at specific interval or day-of-week? I observed this behavior 3 weeks in a row. Could it be?\n\n### To reproduce:\n\n**Host OS**: Debian 12 Bookworm \n**Host Kernel**: Linux debjm02 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux\n**Docker version**: 26.1.1, build 4cf5afa\n**Docker image**: python:3.12-slim-bookworm\n\n#### Mounting \"technique\":\n\n- Windows-based NTFS share is mounted on Debian `via cifs and /etc/fstab` under `/mnt/servers/`\n- Subdirectory `/mnt/servers/myapp/logs/` is then mounted into container under `/logs/` (via docker volumes)\n\n### Creation of Logger with rotating log file\n\n```python\npylogger = logging.getLogger( self.__name__ )\nrotating_file_handler = logging.handlers.RotatingFileHandler(\n    filename='/logs/myapp.log', \n    maxBytes=5_000_000, \n    backupCount=5,\n    encoding='utf-8')\nformatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')\nrotating_file_handler.setFormatter(formatter)\npylogger.addHandler(rotating_file_handler)\n```\n\n### Error and Stacktrace\n```\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.12/logging/handlers.py\", line 73, in emit\n      if self.shouldRollover(record):\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n         File \"/usr/local/lib/python3.12/logging/handlers.py\", line 197, in shouldRollover\n      self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature\n        ^^^^^^^^^^^^^^^^^^^^^^\n    OSError: [Errno 9] Bad file descriptor\nCall stack:\n  File \"/app/__main__.py\", line 213, in \u003cmodule\u003e\n      main()\n      File \"/app/__main__.py\", line 127, in main\n      file_count: int = run_task(task)\n      File \"/app/__main__.py\", line 44, in run_task\n      log.info(f\"{task.name}: Stopping processing for current poll, as poll_max_files have been reached\")\n      File \"/usr/local/lib/python3.12/site-packages/meethpycommons/logger.py\", line 220, in info\n      target.info(obj)\n    Message: 'Auftragsbestätigungen: Stopping processing for current poll, as poll_max_files have been reached'\nArguments: ()\n2024-05-21 09:18:31 [WRN] Auftragsbestätigungen: 30 file/s processed [success/error: 0/30]\n```\n\n### CPython versions tested on:\n\n3.12\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/lollo0296","@type":"Person","name":"lollo0296"},"datePublished":"2024-06-17T15:13:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/120647/cpython/issues/120647"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e9ff71d8-36e6-d3e8-6a9f-3914b855b8f2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8B4A:96FA2:E70689:13D8CEA:6969F2B4
html-safe-nonce7edaf167665c89c3e28f53833362ae0e6c44d9d8c5975988eaa3509a41c9c788
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjRBOjk2RkEyOkU3MDY4OToxM0Q4Q0VBOjY5NjlGMkI0IiwidmlzaXRvcl9pZCI6IjE1NDY4MTA5NTU2MzY3OTgxMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc558133633e531d7407a5b29362ddbb7613577b8c54a5b82cfc0aa51c101183d
hovercard-subject-tagissue:2357599021
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/python/cpython/120647/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7c3628158d92b84f87be5748c6e685f9c481344d5d984b2fc0b34f2e7bc7aab0/python/cpython/issues/120647
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7c3628158d92b84f87be5748c6e685f9c481344d5d984b2fc0b34f2e7bc7aab0/python/cpython/issues/120647
og:image:altBug report Bug description: Issue description The RotatingFileHandler fails to execute the method self.shouldRollover() because of an OSError: [Errno 9] Bad file descriptor. Background info: The is...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelollo0296
hostnamegithub.com
expected-hostnamegithub.com
None7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
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
releasebdde15ad1b403e23b08bbd89b53fbe6bdf688cad
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/120647#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F120647
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F120647
Sign up https://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=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/120647
Reloadhttps://github.com/python/cpython/issues/120647
Reloadhttps://github.com/python/cpython/issues/120647
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/120647
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/120647
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/120647
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/120647
RotatingFileHandler fails when logs are stored in a non-posix file system docker-mounted in Linux-OShttps://github.com/python/cpython/issues/120647#top
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/lollo0296
https://github.com/lollo0296
lollo0296https://github.com/lollo0296
on Jun 17, 2024https://github.com/python/cpython/issues/120647#issue-2357599021
#1https://github.com/python/cpython/pull/1
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Logging issues 🪵https://github.com/orgs/python/projects/15
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.