René's URL Explorer Experiment


Title: Segfault when batch-deleting an IFC aggregate and its decomposed parts · Issue #9299 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: Segfault when batch-deleting an IFC aggregate and its decomposed parts · Issue #9299 · IfcOpenShell/IfcOpenShell

X Title: Segfault when batch-deleting an IFC aggregate and its decomposed parts · Issue #9299 · IfcOpenShell/IfcOpenShell

Description: Bug Description Environment os: Linux (Linux Mint 22.3, kernel 6.14.0-37-generic, glibc 2.39) os_version: #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC python_version: 3.13.13 architecture: x86_64 blender_version: 5.2.0 LTS bonsai_version: 0.8....

Open Graph Description: Bug Description Environment os: Linux (Linux Mint 22.3, kernel 6.14.0-37-generic, glibc 2.39) os_version: #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC python_version: 3.13.13 architecture: x86_64 blender...

X Description: Bug Description Environment os: Linux (Linux Mint 22.3, kernel 6.14.0-37-generic, glibc 2.39) os_version: #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC python_version: 3.13.13 architecture: x86_64 blender...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9299

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segfault when batch-deleting an IFC aggregate and its decomposed parts","articleBody":"### Bug Description\n\n**Environment**\n\n- os: Linux (Linux Mint 22.3, kernel 6.14.0-37-generic, glibc 2.39)\n- os_version: `#37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC`\n- python_version: 3.13.13\n- architecture: x86_64\n- blender_version: 5.2.0 LTS\n- bonsai_version: `0.8.6a260813` (alpha build from commit\n  `1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2`, installed via the Blender\n  extension manager — a Blender extension, not bundled)\n\n**Description**\n\nDeleting an IFC aggregate (e.g. an `IfcStair`) **together with its\nparts** (`IfcStairFlight`, `IfcSlab`) in a single\n`bim.override_object_delete` batch closes Blender with a native\nsegfault. The crash is a C++ fault (`__dynamic_cast`) inside the\nifcopenshell binding layer; it is *not* a catchable Python exception,\nso Blender exits entirely and any unsaved work is lost.\n\n**Suspected cause**\n\n`OverrideDelete.track_aggregates()` retains live\n`ifcopenshell.entity_instance` objects *before* the deletion loop. When\nan aggregate is also selected, `remove_product` can remove its backing\nIFC entity during that loop. `delete_empty_aggregates()` later calls\n`.id()` on the retained wrapper, which can dereference an invalid native\nentity and segfault before Python can raise or handle an exception.\n\nReferences (at commit `1af5cc9`):\n\n- [operator.py L895](https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L895)\n  — `aggregates_to_check = self.track_aggregates(objects_to_remove)`\n  (wrappers snapshotted before deletion)\n- [operator.py L989](https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L989)\n  — `def track_aggregates(self, objects_to_remove)` stores live wrappers\n  in a `set`\n- [operator.py L955](https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L955)\n  — `self.delete_empty_aggregates(aggregates_to_check)` runs after the\n  parts were removed\n- [operator.py L1009](https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L1009)\n  — `aggregate.id()` on a wrapper whose C++ entity was already destroyed\n  (the `try/except` at\n  [L1008-1011](https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L1008)\n  cannot catch a native segfault)\n\n**Reproduction**\n\nSelf-contained script (`repro_segfault.py.txt`, attached). Only Bonsai +\nifcopenshell, no third-party add-on: builds a fresh in-memory IFC4 model\nwith an `IfcStair` + parts, links Blender objects to the entities,\nselects the aggregate and all of its parts, and runs\n`bpy.ops.bim.override_object_delete(is_batch=False)`.\n\n```bash\nblender --background --python repro_segfault.py\n```\n\nExpected: Blender segfaults and writes `blender.crash.txt`. If the bug\nis fixed, the script prints `DELETE_FINISHED` and the IFC graph is\nempty.\n\n**Backtrace** (native + Python, from `blender.crash.txt` written by the\nscript reproduction):\n\n```\n/lib/x86_64-linux-gnu/libstdc++.so.6(__dynamic_cast+0x21)\n.../ifcopenshell/_ifcopenshell_wrapper.cpython-313-x86_64-linux-gnu.so(+0x36eb7b8)\n\n# Python backtrace\n  File \".../ifcopenshell/ifcopenshell_wrapper.py\", line 6352 in id\n  File \".../ifcopenshell/entity_instance.py\", line 442 in id\n  File \".../bonsai/bim/module/geometry/operator.py\", line 1009 in delete_empty_aggregates\n  File \".../bonsai/bim/module/geometry/operator.py\", line 955 in _execute\n  File \".../bonsai/bim/ifc.py\", line 562 in execute_ifc_operator\n  File \".../bonsai/bim/module/geometry/operator.py\", line 853 in execute\n```\n\nThe Python frame confirms the failure is exactly `aggregate.id()` at\n`operator.py:1009`, reached from `delete_empty_aggregates` after the\ndelete loop.\n\n**Expected behaviour**\n\nDeleting a selection that includes both an aggregate and all of its\nparts must complete without accessing IFC entity handles that were\ninvalidated earlier in the same operation.\n\n**Proposed direction**\n\nStore aggregate STEP ids before deletion rather than entity wrappers.\nAfter deletion, re-resolve each id from the active IFC file and ignore\nids that no longer resolve. This avoids dereferencing an entity wrapper\nafter its native object has been removed.\n\nBonsai already ships\n[`tool.Ifc.get_entity_by_id(entity_id)`](https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/tool/ifc.py#L166),\nwhich wraps `file.by_id()` in `try/except RuntimeError` and returns\n`None` when the entity no longer exists — ideal for re-resolving ids\nsafely.\n\nThis is a pragmatic mitigation at the Bonsai layer. The underlying class\nof bug — Python wrappers left dangling after their C++ entity is removed\n— has precedents in ifcopenshell core, notably\n[#4564](https://github.com/IfcOpenShell/IfcOpenShell/issues/4564)\n(segfault when using an entity saved in a variable after it was removed;\nthe recommended workaround there was exactly \"don't keep the entity,\nre-fetch it when needed\") and\n[#1224](https://github.com/IfcOpenShell/IfcOpenShell/issues/1224)\n(\"removal with inverse attributes is still buggy\"), so a deeper fix in\ncore would also be welcome.\n\nThe fix described here is already implemented and working in the add-on\nthat hit this bug, as a temporary monkey-patch (id-based\n`track_aggregates` / `delete_empty_aggregates`). I'd be happy to port it\nto `operator.py` as a pull request with a regression test if that helps.\n\n**Verification performed**\n\n- Crash reproduced on factory Bonsai `0.8.6a260813` (pristine\n  `OverrideDelete`, no add-on monkey-patching): Blender segfaults and\n  writes `blender.crash.txt` with the backtrace above.\n- Not verified against the newest unstable build; the version tested is\n  the latest distributed via the Blender 5.2 extension manager at the\n  time of writing.\n\n### Attachments\n\n[repro_segfault.py.txt](https://github.com/user-attachments/files/31059821/repro_segfault.py.txt)\n[Example.ifc.txt](https://github.com/user-attachments/files/31059847/Example.ifc.txt)\n\n### Debug and Error Output\n\n```true\n\n```","author":{"url":"https://github.com/odofaro","@type":"Person","name":"odofaro"},"datePublished":"2026-08-14T07:55:54Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9299"}

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:dc803c4d-ebae-93ed-9023-9e0b006eef1c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD080:13C02D:3BF57F:54D80A:6B046F8B
html-safe-nonce9f35fad85861181d908e561d0ced50d015a391e6d61292c3b61abfccf2117036
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDgwOjEzQzAyRDozQkY1N0Y6NTREODBBOjZCMDQ2RjhCIiwidmlzaXRvcl9pZCI6IjIxNjY2NjY4NjM1MjQ5OTkwNTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac66d91b48df68d0fe1c8e52f7456499dc9f3b70d559228e326d5deb8019e4aa55
hovercard-subject-tagissue:5149565110
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/IfcOpenShell/IfcOpenShell/9299/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8631a3698735643b34f5092b23bd7bdc8d3c34faf4a81d8d0b3c18c153f96e6d/IfcOpenShell/IfcOpenShell/issues/9299
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8631a3698735643b34f5092b23bd7bdc8d3c34faf4a81d8d0b3c18c153f96e6d/IfcOpenShell/IfcOpenShell/issues/9299
og:image:altBug Description Environment os: Linux (Linux Mint 22.3, kernel 6.14.0-37-generic, glibc 2.39) os_version: #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC python_version: 3.13.13 architecture: x86_64 blender...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameodofaro
hostnamegithub.com
expected-hostnamegithub.com
Noneae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f
turbo-cache-controlno-preview
go-importgithub.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git
octolytics-dimension-user_id13692563
octolytics-dimension-user_loginIfcOpenShell
octolytics-dimension-repository_id40473201
octolytics-dimension-repository_nwoIfcOpenShell/IfcOpenShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id40473201
octolytics-dimension-repository_network_root_nwoIfcOpenShell/IfcOpenShell
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
releasecfb5f24c6e01d85f70804652a5107e5cac03a161
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/9299#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9299
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%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9299
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=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9299
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9299
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9299
IfcOpenShellhttps://github.com/IfcOpenShell
IfcOpenShellhttps://github.com/IfcOpenShell/IfcOpenShell
Codehttps://github.com/IfcOpenShell/IfcOpenShell
Issues1.2k (1.2k)https://github.com/IfcOpenShell/IfcOpenShell/issues
Pull requests937 (937)https://github.com/IfcOpenShell/IfcOpenShell/pulls
Discussionshttps://github.com/IfcOpenShell/IfcOpenShell/discussions
Actionshttps://github.com/IfcOpenShell/IfcOpenShell/actions
Projectshttps://github.com/IfcOpenShell/IfcOpenShell/projects
Wikihttps://github.com/IfcOpenShell/IfcOpenShell/wiki
Security and qualityhttps://github.com/IfcOpenShell/IfcOpenShell/security
Insightshttps://github.com/IfcOpenShell/IfcOpenShell/insights
https://github.com/IfcOpenShell/IfcOpenShell
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9299
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9299
Bughttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=type:"Bug"
#9624https://github.com/IfcOpenShell/IfcOpenShell/pull/9624
Segfault when batch-deleting an IFC aggregate and its decomposed partshttps://github.com/IfcOpenShell/IfcOpenShell/issues/9299#top
#9624https://github.com/IfcOpenShell/IfcOpenShell/pull/9624
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com/odofaro
odofarohttps://github.com/odofaro
on Aug 14, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9299#issue-5149565110
operator.py L895https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L895
operator.py L989https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L989
operator.py L955https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L955
operator.py L1009https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L1009
L1008-1011https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/bim/module/geometry/operator.py#L1008
tool.Ifc.get_entity_by_id(entity_id)https://github.com/IfcOpenShell/IfcOpenShell/blob/1af5cc9bbe5e81814e1fb744f6fa77b41ba869b2/src/bonsai/bonsai/tool/ifc.py#L166
#4564https://github.com/IfcOpenShell/IfcOpenShell/issues/4564
#1224https://github.com/IfcOpenShell/IfcOpenShell/issues/1224
repro_segfault.py.txthttps://github.com/user-attachments/files/31059821/repro_segfault.py.txt
Example.ifc.txthttps://github.com/user-attachments/files/31059847/Example.ifc.txt
odofarohttps://github.com/odofaro
Bughttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=type:"Bug"
on Aug 14, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9299#event-29446094344
https://github.com/petruconduraru
petruconduraruhttps://github.com/petruconduraru
on Aug 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9299#issuecomment-5302638716
@odofarohttps://github.com/odofaro
petruconduraruhttps://github.com/petruconduraru
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
on Aug 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9299#event-29500900544
https://github.com/odofaro
odofarohttps://github.com/odofaro
on Aug 16, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9299#issuecomment-5306140255
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9299
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9299
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
Bughttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=type:"Bug"
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.