Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quality] Possible Emitter memory leak detected when opening more than 15 editors #3145

Closed
kittaakos opened this issue Oct 11, 2018 · 6 comments
Labels
java issues related to the java language quality issues related to code and application quality

Comments

@kittaakos
Copy link
Contributor

In my case, it was the Java editor:

Possible Emitter memory leak detected. 30 exit listeners added. Use event.maxListeners to increase limit
    at Emitter.../../packages/core/lib/common/event.js.Emitter.checkMaxListeners (http://localhost:3000/bundle.js:100299:26)
    at Proxy._event.Object.assign.maxListeners (http://localhost:3000/bundle.js:100266:27)
    at MonacoEditorProvider.<anonymous> (http://localhost:3000/26.bundle.js:686:63)
    at step (http://localhost:3000/26.bundle.js:540:23)
    at Object.next (http://localhost:3000/26.bundle.js:521:53)
    at fulfilled (http://localhost:3000/26.bundle.js:512:58)
log @ logger-protocol.ts:99
(anonymous) @ logger-frontend-module.ts:41
(anonymous) @ logger.ts:312
(anonymous) @ logger.ts:304
Promise.then (async)
../../packages/core/lib/common/logger.js.Logger.log @ logger.ts:299
log @ logger.ts:45
../../packages/core/lib/common/event.js.Emitter.checkMaxListeners @ event.ts:189
_event.Object.assign.maxListeners @ event.ts:155
(anonymous) @ monaco-editor-provider.js:213
step @ monaco-editor-provider.js:67
(anonymous) @ monaco-editor-provider.js:48
fulfilled @ monaco-editor-provider.js:39
Promise.then (async)
step @ monaco-editor-provider.js:41
(anonymous) @ monaco-editor-provider.js:42
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.__awaiter @ monaco-editor-provider.js:38
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.MonacoEditorProvider.createMonacoEditor @ monaco-editor-provider.js:203
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.MonacoEditorProvider.createEditor @ monaco-editor-provider.js:193
(anonymous) @ monaco-editor-provider.js:155
(anonymous) @ monaco-editor-provider.js:170
step @ monaco-editor-provider.js:67
(anonymous) @ monaco-editor-provider.js:48
(anonymous) @ monaco-editor-provider.js:42
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.__awaiter @ monaco-editor-provider.js:38
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.MonacoEditorProvider.doCreateEditor @ monaco-editor-provider.js:161
(anonymous) @ monaco-editor-provider.js:155
step @ monaco-editor-provider.js:67
(anonymous) @ monaco-editor-provider.js:48
fulfilled @ monaco-editor-provider.js:39
Promise.then (async)
step @ monaco-editor-provider.js:41
(anonymous) @ monaco-editor-provider.js:42
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.__awaiter @ monaco-editor-provider.js:38
push.../../packages/monaco/lib/browser/monaco-editor-provider.js.MonacoEditorProvider.get @ monaco-editor-provider.js:148
(anonymous) @ monaco-frontend-module.ts:76
(anonymous) @ editor-widget-factory.ts:47
step @ editor-widget-factory.ts:15
(anonymous) @ editor-widget-factory.ts:15
fulfilled @ editor-widget-factory.ts:15
Promise.then (async)
step @ editor-widget-factory.ts:15
(anonymous) @ editor-widget-factory.ts:15
push.../../packages/editor/lib/browser/editor-widget-factory.js.__awaiter @ editor-widget-factory.ts:15
push.../../packages/editor/lib/browser/editor-widget-factory.js.EditorWidgetFactory.createEditor @ editor-widget-factory.ts:45
push.../../packages/editor/lib/browser/editor-widget-factory.js.EditorWidgetFactory.createWidget @ editor-widget-factory.ts:42
(anonymous) @ widget-manager.ts:130
step @ widget-manager.ts:15
(anonymous) @ widget-manager.ts:15
fulfilled @ widget-manager.ts:15
Promise.then (async)
step @ widget-manager.ts:15
(anonymous) @ widget-manager.ts:15
../../packages/core/lib/browser/widget-manager.js.__awaiter @ widget-manager.ts:15
../../packages/core/lib/browser/widget-manager.js.WidgetManager.getOrCreateWidget @ widget-manager.ts:119
../../packages/core/lib/browser/widget-open-handler.js.WidgetOpenHandler.getOrCreateWidget @ widget-open-handler.ts:166
(anonymous) @ widget-open-handler.ts:83
step @ widget-open-handler.ts:15
(anonymous) @ widget-open-handler.ts:15
(anonymous) @ widget-open-handler.ts:15
../../packages/core/lib/browser/widget-open-handler.js.__awaiter @ widget-open-handler.ts:15
../../packages/core/lib/browser/widget-open-handler.js.WidgetOpenHandler.open @ widget-open-handler.ts:82
(anonymous) @ editor-manager.ts:104
step @ editor-manager.ts:15
(anonymous) @ editor-manager.ts:15
(anonymous) @ editor-manager.ts:15
push.../../packages/editor/lib/browser/editor-manager.js.__awaiter @ editor-manager.ts:15
push.../../packages/editor/lib/browser/editor-manager.js.EditorManager.open @ editor-manager.ts:103
(anonymous) @ typehierarchy-tree-widget.tsx:94
step @ typehierarchy-tree-widget.tsx:15
(anonymous) @ typehierarchy-tree-widget.tsx:15
(anonymous) @ typehierarchy-tree-widget.tsx:15
push.../../packages/typehierarchy/lib/browser/tree/typehierarchy-tree-widget.js.__awaiter @ typehierarchy-tree-widget.tsx:15
push.../../packages/typehierarchy/lib/browser/tree/typehierarchy-tree-widget.js.TypeHierarchyTreeWidget.openEditor @ typehierarchy-tree-widget.tsx:91
(anonymous) @ typehierarchy-tree-widget.tsx:53
../../packages/core/lib/common/event.js.CallbackList.invoke @ event.ts:107
../../packages/core/lib/common/event.js.Emitter.fire @ event.ts:199
../../packages/core/lib/browser/tree/tree-selection-impl.js.TreeSelectionServiceImpl.fireSelectionChanged @ tree-selection-impl.ts:50
../../packages/core/lib/browser/tree/tree-selection-impl.js.TreeSelectionServiceImpl.addSelection @ tree-selection-impl.ts:87
../../packages/core/lib/browser/tree/tree-model.js.TreeModelImpl.addSelection @ tree-model.ts:388
../../packages/core/lib/browser/tree/tree-model.js.TreeModelImpl.selectPrevNode @ tree-model.ts:267
../../packages/core/lib/browser/tree/tree-widget.js.TreeWidget.handleUp @ tree-widget.tsx:663
(anonymous) @ tree-widget.tsx:630
(anonymous) @ widget.ts:180

Also: theia-ide/yangster#62

@kittaakos kittaakos added the quality issues related to code and application quality label Oct 11, 2018
@lmcbout
Copy link
Contributor

lmcbout commented Oct 11, 2018

Could be related to issue #3023 as well. I also reproduce a memory leak with only one JAVA editor. I start theia, open a java file , then I stop and re-start the server. DO NOT REFRESH the client side. After ~15-30 sec, I see the memory leak on the server console and if I open a memroy tool (htop on ubuntu), i see the cpu is consuming 100% on all cores of my computer and remains like that for a long time. We see as well many java processes running .
See picture below

issue_3145

@kittaakos kittaakos added the java issues related to the java language label Oct 12, 2018
@kittaakos
Copy link
Contributor Author

kittaakos commented Oct 12, 2018

I have added a dummy logging to the Java backend contribution, had the frontend running in the browser and restarted the backend. See how many times the backend tries to reconnect:

"3000"
root INFO [nsfw-watcher: 16577] Started watching: /Users/akos.kitta/git/theia/examples/browser/package.json
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Unregistering scopes for language: java.
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331203596/.metadata/.log
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331203675/.metadata/.log
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331203705/.metadata/.log
root INFO The scopes have been successfully unregistered for java.
root INFO Started watching the git repository: file:///Users/akos.kitta/git/eclipse.jdt.ls
root INFO Checking whether '--no-optional-locks' can be used with the current Git executable. Minimum required version is '2.15.0'.
root INFO [nsfw-watcher: 16578] Started watching: /Users/akos.kitta/.theia
root INFO Checking whether '--no-optional-locks' can be used with the current Git executable. Minimum required version is '2.15.0'.
root INFO [nsfw-watcher: 16578] Started watching: /Users/akos.kitta/git/eclipse.jdt.ls
root INFO Checking whether '--no-optional-locks' can be used with the current Git executable. Minimum required version is '2.15.0'.
root INFO [nsfw-watcher: 16578] Started watching: /Users/akos.kitta/git/eclipse.jdt.ls
root INFO '--no-optional-locks' is a valid Git option for the current Git version: '2.17.1'.
root INFO '--no-optional-locks' is a valid Git option for the current Git version: '2.17.1'.
root INFO [nsfw-watcher: 16578] Started watching: /Users/akos.kitta/git/eclipse.jdt.ls/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BundleUtils.java
root INFO '--no-optional-locks' is a valid Git option for the current Git version: '2.17.1'.
root INFO Registering scopes for language: java.
root INFO The scopes have been successfully registered for java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331254132/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331259199/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331269473/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331275000/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331284115/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331289170/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331299830/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331304305/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331311244/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331316022/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331323659/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331327191/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331335481/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331338907/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331348432/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331358475/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331362507/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331372139/.metadata/.log
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331377059/.metadata/.log
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root INFO Registering scopes for language: java.
root ERROR The scopes are already registered for language: java.
root WARN A command java.edit.organizeImports is already registered.
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: logs at /var/folders/k3/d2fkvv1j16v3_rz93k7f74180000gn/T/_ws_1539331386633/.metadata/.log

And finally, we will hit the Possible Emitter memory leak detected. issue and the backend crash:

root INFO [nsfw-watcher: 18535] Started watching: /Users/akos.kitta/.theia
assert.js:42
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: false == true
    at RoundRobinHandle.add (internal/cluster/round_robin_handle.js:34:3)
    at queryServer (internal/cluster/master.js:316:10)
    at Worker.onmessage (internal/cluster/master.js:248:5)
    at ChildProcess.onInternalMessage (internal/cluster/utils.js:42:8)
    at emitTwo (events.js:131:20)
    at ChildProcess.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
root INFO Java: HERE!!!!! starting the JDT LS
root INFO Java: HERE!!!!! starting the JDT LS

@tsmaeder
Copy link
Contributor

tsmaeder commented Mar 5, 2021

@kittaakos related to the former java extension, I believe. Close?

@kittaakos
Copy link
Contributor Author

Just open enough editors, any kind of them, and you will see the warning:

logger-protocol.ts:112 root WARN     at PreferenceServiceImpl._event.Object.assign.maxListeners [as onPreferencesChanged] (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:134774:57)
    at Proxy.onPreferenceChanged (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:114175:95)
    at MonacoTextModelService.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/16.bundle.js:925:61)
    at step (file:///Users/akos.kitta/git/theia/examples/electron/lib/16.bundle.js:831:23)
    at Object.next (file:///Users/akos.kitta/git/theia/examples/electron/lib/16.bundle.js:812:53

@kittaakos
Copy link
Contributor Author

kittaakos commented Jan 29, 2024

Possible related: #13327 and #13323

@msujew
Copy link
Member

msujew commented Feb 22, 2024

Given that this is related to the old (and long deprecated) java extension, we can close this.

@msujew msujew closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java issues related to the java language quality issues related to code and application quality
Projects
None yet
Development

No branches or pull requests

4 participants