donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
289 stars 57 forks source link

Freeze the latest PyCharm IDE 2023.3.2 when create a python file. #588

Open wuhongyewhy opened 5 months ago

wuhongyewhy commented 5 months ago

What I did

create a python file.

What happened

The IDE freeze.

What I wanted to happen

Work normally.

My environment

Describe the versions of everything you were using:

Other feedback

Verified by disable the plugin, than every thing goes normal.

Workaround

Choose New: File, instead of New: Python File.

thomasleveil commented 5 months ago

Also see https://youtrack.jetbrains.com/issue/PY-66322/Right-clicking-to-create-a-new-file-.py-file-in-an-existing-directory-doesnt-work-and-PyCharm-freezes.-A-hard-reboot-of-PyCharm

I can reproduce the bug only when this plugin is active. I'm running PyCharm Pro 2023.3.2 (Build #PY-233.13135.95, built on December 19, 2023) on Linux Mint 21.2 with openjdk 17.0.9

donkirkby commented 5 months ago

Thanks for the bug report, but I haven't been able to reproduce the problem yet. Could one of you please try running PyCharm Pro 2023.3.3? Here are the steps I tried:

  1. Open PyCharm and either open an existing project or create a new one.
  2. Close all files in PyCharm.
  3. From the File menu, choose Settings...: Plugins, and check that Live Coding in Python v4.11.3 is installed.
  4. Close the Settings dialog box.
  5. From the File menu, choose Invalidate Caches....
  6. Leave all the checkboxes unchecked, and click Invalidate and Restart.
  7. Once it restarts, right click on your project folder, and choose New: File.
  8. Type a name for the new file, and press enter.

When I do this, it works fine and creates the file without freezing. I tried it with these versions:

Please let me know if you used different steps to reproduce the problem. I'll see if I can try it with the same versions that you reported using.

thomasleveil commented 5 months ago

Hi @donkirkby

I followed your instructions and it does not freeze.

Here's a different scenario that produces the freeze :

One of the PyCharm processes get stuck and can only be killed with the SIGKILL signal.

Note that if we choose "Python stub", there is no freeze.

PyCharm logs

threadDump ``` "AWT-EventQueue-0" prio=0 tid=0x0 nid=0x0 waiting on condition java.lang.Thread.State: TIMED_WAITING on kotlinx.coroutines.BlockingCoroutine@71857317 at java.base@17.0.9/jdk.internal.misc.Unsafe.park(Native Method) at java.base@17.0.9/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:88) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at com.intellij.openapi.progress.CoroutinesKt$runBlockingCancellable$1.invoke(coroutines.kt:133) at com.intellij.openapi.progress.CoroutinesKt$runBlockingCancellable$1.invoke(coroutines.kt:127) at com.intellij.openapi.progress.ContextKt.prepareThreadContext(context.kt:86) at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:127) at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:122) at io.github.donkirkby.livepycharm.SplitFileEditorProvider.getBuilderFromEditorProvider(SplitFileEditorProvider.java:317) at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditorAsync(SplitFileEditorProvider.java:77) at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditor(SplitFileEditorProvider.java:53) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.createComposite(FileEditorManagerImpl.kt:1206) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.doOpenInEdtImpl(FileEditorManagerImpl.kt:1118) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4$open(FileEditorManagerImpl.kt:1039) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4$intellij_platform_ide_impl(FileEditorManagerImpl.kt:1050) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.doOpenFile(FileEditorManagerImpl.kt:814) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFile(FileEditorManagerImpl.kt:804) at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.kt:148) at com.intellij.ide.actions.CreateFileFromTemplateAction.createFileFromTemplate(CreateFileFromTemplateAction.java:115) at com.intellij.ide.actions.CreateFileFromTemplateAction.createFileFromTemplate(CreateFileFromTemplateAction.java:82) at com.intellij.ide.actions.CreateFileFromTemplateAction.createFileFromTemplate(CreateFileFromTemplateAction.java:72) at com.intellij.ide.actions.CreateFileFromTemplateAction.createFileFromTemplate(CreateFileFromTemplateAction.java:63) at com.intellij.ide.actions.CreateFileFromTemplateAction.createFile(CreateFileFromTemplateAction.java:140) at com.intellij.ide.actions.CreateFileFromTemplateAction.createFile(CreateFileFromTemplateAction.java:45) at com.intellij.ide.actions.CreateFromTemplateAction$1.createFile(CreateFromTemplateAction.java:85) at com.intellij.ide.actions.CreateFromTemplateAction$1.createFile(CreateFromTemplateAction.java:80) at com.intellij.ide.actions.CreateFileFromTemplateDialog$NonBlockingPopupBuilderImpl$1.create(CreateFileFromTemplateDialog.java:300) at com.intellij.ide.actions.ElementCreator.lambda$tryCreate$0(ElementCreator.java:46) at com.intellij.ide.actions.ElementCreator$$Lambda$8012/0x00000008028b5810.run(Unknown Source) at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:85) at com.intellij.openapi.application.WriteAction$$Lambda$8015/0x00000008028bacc8.compute(Unknown Source) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:963) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:989) at com.intellij.openapi.application.WriteAction.run(WriteAction.java:84) at com.intellij.ide.actions.ElementCreator.lambda$executeCommand$1(ElementCreator.java:64) at com.intellij.ide.actions.ElementCreator$$Lambda$8013/0x00000008028b5a60.run(Unknown Source) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:225) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:167) at com.intellij.ide.actions.ElementCreator.executeCommand(ElementCreator.java:60) at com.intellij.ide.actions.ElementCreator.tryCreate(ElementCreator.java:45) at com.intellij.ide.actions.CreateFileFromTemplateDialog$NonBlockingPopupBuilderImpl.createElement(CreateFileFromTemplateDialog.java:361) at com.intellij.ide.actions.CreateFileFromTemplateDialog$NonBlockingPopupBuilderImpl.lambda$show$2(CreateFileFromTemplateDialog.java:332) at com.intellij.ide.actions.CreateFileFromTemplateDialog$NonBlockingPopupBuilderImpl$$Lambda$7989/0x00000008028a0000.consume(Unknown Source) at com.intellij.ide.ui.newItemPopup.NewItemSimplePopupPanel$1.keyPressed(NewItemSimplePopupPanel.java:128) at java.desktop/java.awt.Component.processKeyEvent(Component.java:6615) at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2892) at java.desktop/java.awt.Component.processEvent(Component.java:6434) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855) at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:886) at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1166) at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1023) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:849) at com.intellij.ide.IdeKeyboardFocusManager.access$dispatchEvent$s1569605750(IdeKeyboardFocusManager.kt:18) at com.intellij.ide.IdeKeyboardFocusManager$dispatchEvent$1.invoke(IdeKeyboardFocusManager.kt:25) at com.intellij.ide.IdeKeyboardFocusManager$dispatchEvent$1.invoke(IdeKeyboardFocusManager.kt:25) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014) at com.intellij.ide.IdeEventQueueKt$$Lambda$1075/0x0000000800a32600.run(Unknown Source) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014) at com.intellij.ide.IdeKeyboardFocusManager.dispatchEvent(IdeKeyboardFocusManager.kt:25) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4904) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2809) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:794) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733) at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:776) at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base@17.0.9/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base@17.0.9/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:766) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:764) at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:776) at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base@17.0.9/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:763) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695) at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:623) at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$11(IdeEventQueue.kt:581) at com.intellij.ide.IdeEventQueue$$Lambda$7797/0x00000008026fa828.run(Unknown Source) at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75) at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:581) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014) at com.intellij.ide.IdeEventQueueKt$$Lambda$1075/0x0000000800a32600.run(Unknown Source) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:114) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349) at com.intellij.ide.IdeEventQueue$$Lambda$1072/0x0000000800a31ca0.run(Unknown Source) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) ```

Environnement:

donkirkby commented 5 months ago

Great! I can reproduce it now. Merci pour l'aide, @thomasleveil.

jolly-jump commented 1 month ago

Hi. Still have the problem with


2024-05-09 12:13:40,056 [ 240795] SEVERE - #c.i.o.progress - There is no ProgressIndicator or Job in this thread, the current job is not cancellable.
java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable.
        at com.intellij.openapi.progress.CoroutinesKt.invoke(coroutines.kt:128)
        at com.intellij.openapi.progress.CoroutinesKt.invoke(coroutines.kt:126)
        at com.intellij.openapi.progress.ContextKt.prepareThreadContext(context.kt:83)
        at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:126)
        at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:121)
        at io.github.donkirkby.livepycharm.SplitFileEditorProvider.getBuilderFromEditorProvider(SplitFileEditorProvider.java:317)
        at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditorAsync(SplitFileEditorProvider.java:77)
        at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditor(SplitFileEditorProvider.java:53)
        at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.createComposite(FileEditorManagerImpl.kt:1205)

...

        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
2024-05-09 12:13:40,063 [ 240802] SEVERE - #c.i.o.progress - PyCharm 2024.1.1  Build #PC-241.15989.155
2024-05-09 12:13:40,063 [ 240802] SEVERE - #c.i.o.progress - JDK: 17.0.10; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2024-05-09 12:13:40,063 [ 240802] SEVERE - #c.i.o.progress - OS: Linux
2024-05-09 12:13:40,063 [ 240802] SEVERE - #c.i.o.progress - Plugin to blame: Live Coding in Python version: 4.11.4
2024-05-09 12:13:40,064 [ 240803] SEVERE - #c.i.o.progress - Last Action: NewDirectoryProject
donkirkby commented 1 month ago

Thanks for the report, @jolly-jump. Does the workaround work for you?

jolly-jump commented 1 month ago

Hi @donkirkby , yes, the workaround: open "New File" instead of "New Python file" works. However, i could not see a connection to using "invalidate caches".

The workaround is not practicable for me, since I want to use the feature "create a main.py" when creating a new project since this automatically creates a run configuration. (instead of having to create a run configuration otherwise)

My workaround consists now in pre-disabling the plugin and then let the users activate it, when they have their project ready.