Summary: | LibreOffice becomes unresponsive and crashes, accompanied by a significant increase in memory usage, when attempting to declare a new object instance of a class module, leading to severe data loss. | ||
---|---|---|---|
Product: | LibreOffice | Reporter: | Henrry John <jem203516> |
Component: | BASIC | Assignee: | Not Assigned <libreoffice-bugs> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | jem203516 |
Priority: | medium | ||
Version: | 7.6.5.2 release | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Windows (All) | ||
Whiteboard: | QA:needsComment | ||
Crash report or crash signature: | Regression By: |
Description
Henrry John
2024-02-29 12:50:16 UTC
Personal insights of the matters: The crash appears to occur before any opportunity for manual or automatic cleanup processes. Since the object instance is declared outside the scope of any subroutines or functions, both manual cleanup (using `Nothing`) and automatic cleanup via garbage collection might not be triggered. This lack of cleanup could lead to a memory leak, possibly explaining the unresponsiveness and crash of all LibreOffice instances and the sudden spike in memory usage. In situations where crashes happen during the instantiation phase, understanding how the BASIC interpreter allocates and manages memory for class objects, especially when declared globally or at a module level, becomes crucial. It's important to note that these insights are speculative, providing a hypothesis for consideration. The real root cause may lie elsewhere in the handling of class objects within the LibreOffice BASIC interpreter. Further analysis of the interpreter's internals is necessary for a conclusive understanding of the issue. **New Information and Steps to Mitigate the Crash:** After in-depth testing and profile resets, I observed a notable behavior related to the crash. Specifically, excluding the "TestRun" method and the problematic instantiation code within the "UserClass" module seems to prevent the crash. This discovery suggests a potential correlation between the crash and the action of declaring an instance of the "UserClass" within the "UserClass" module itself. **Steps to Mitigate the Crash:** 1. Open LibreOffice and navigate to the "UserClass" module. 2. Exclude the "TestRun" method and the problematic instantiation code. 3. Save and compile the modified code. 4. Execute the modified code and observe if the crash still occurs. **Analysis and Insights:** The exclusion of the "TestRun" method appears to be a workaround to mitigate the crash. This aligns with the hypothesis that the crash might be related to the instantiation of the class within its own module. As mentioned in a previous comment, the potential issue could be akin to recursion, where the object creates an instance of the class, and the class itself tries to create an object instance of itself, leading to resource over-utilization and the subsequent crash of LibreOffice instances. Notably, in a new module within the same library as "UserClass," declaring the instance of "UserClass" outside the scope of subs or functions encountered no issues. This could indicate that the problem might be specific to certain instantiation contexts within the same module. **Potential Implications and Future Considerations:** If the hypothesis regarding the recursion-like issue is confirmed, it would be advisable to implement a mechanism preventing users from inadvertently creating such recursion. This could involve introducing safeguards in the BASIC interpreter to detect and handle instances of potential recursion during class instantiation. **Additional Notes:** These steps serve as a temporary mitigation measure and do not address the root cause of the issue. Further analysis of the LibreOffice BASIC interpreter's handling of class instantiation within the same module is necessary for a comprehensive resolution. Reproducible: Yes (Mitigated) |