Skip to content

MacOSX: TkAgg backend sluggishness in combination with ipython interactive #9077

Closed as not planned
@jclevesque

Description

@jclevesque

Bug report

Bug summary

If I plot any relatively large figure, execute my script with ipython -i, when I fall at the interactive prompt my whole system becomes unresponsive. Alt-tabbing gets slow, typing, etc. When I exit with Ctrl-D, I get an error stack printed which seems pretty long (abnormally long? can't tell).

Code for reproduction

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np

test_image = np.random.sample((100, 100))

plt.imshow(test_image)
plt.show()

and execute it with ipython3 -i.

Actual outcome

Whole OS starts becoming unresponsive. Upon exiting the prompt, following error stack gets printed.

Do you really want to exit ([y]/n)? 2017-08-23 10:02:10.978 Python[5180:141513] IMKClient Stall detected, *please Report* your user scenario attaching a spindump (or sysdiagnose) that captures the problem - (imkxpc_presentFunctionRowItemTextInputViewWithEndpoint:reply:) block performed very slowly (5.22 secs).
2017-08-23 10:02:10.980 Python[5180:141513] IMKClient Stall detected, *please Report* your user scenario attaching a spindump (or sysdiagnose) that captures the problem - (imkxpc_presentFunctionRowItemTextInputViewWithEndpoint:reply:) block performed very slowly (2.75 secs).
2017-08-23 10:02:10.988 Python[5180:141513] *** Assertion failure in -[NSRemoteView informAuxServiceOfSelf], /Library/Caches/com.apple.xbs/Sources/ViewBridge/ViewBridge-283/NSRemoteView.m:3207
2017-08-23 10:02:10.990 Python[5180:141513] IMKInputSession presentFunctionRowItemTextInputViewWithEndpoint:completionHandler: : [self textInputContext]=0x0 *NO* NSRemoteViewController to client, NSError=Error Domain=com.apple.ViewBridge Code=8 "(null)" UserInfo={com.apple.ViewBridge.error.hint=__38-[NSRemoteView _advanceToConfigPhase:]_block_invoke.2466 caught NSInternalInconsistencyException '<NSRemoteView: 0x7faa7fbd1a70> failed to rendezvous via aux service' with backtrace (
	0   CoreFoundation                      0x00007fffac8842cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffc169448d objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffac889042 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00007fffae2d1be0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
	4   ViewBridge                          0x00007fffc00e9b34 -[NSRemoteView informAuxServiceOfSelf] + 345
	5   ViewBridge                          0x00007fffc00ea47e -[NSRemoteView _finishAdvanceToConfigPhaseWithContextID:andServiceViewSize:andOffset:] + 685
	6   ViewBridge                          0x00007fffc00fe298 __38-[NSRemoteView _advanceToConfigPhase:]_block_invoke.2466 + 103
	7   CoreFoundation                      0x00007fffac7f7b8c __invoking___ + 140
	8   CoreFoundation                      0x00007fffac7f7a11 -[NSInvocation invoke] + 289
	9   ViewBridge                          0x00007fffc0125579 withHintInProgress + 487
	10  ViewBridge                          0x00007fffc01252b0 __deferNSXPCInvocationOntoMainThread_block_invoke_2 + 233
	11  ViewBridge                          0x00007fffc00a9459 +[NSViewServiceApplication withHostPID:invoke:] + 46
	12  ViewBridge                          0x00007fffc0125173 __deferNSXPCInvocationOntoMainThread_block_invoke + 179
	13  ViewBridge                          0x00007fffc0124d67 __deferBlockOntoMainThread_block_invoke_2 + 544
	14  CoreFoundation                      0x00007fffac81a17c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
	15  CoreFoundation                      0x00007fffac7faf84 __CFRunLoopDoBlocks + 356
	16  CoreFoundation                      0x00007fffac7fa705 __CFRunLoopRun + 917
	17  CoreFoundation                      0x00007fffac7fa114 CFRunLoopRunSpecific + 420
	18  HIToolbox                           0x00007fffabd5aebc RunCurrentEventLoopInMode + 240
	19  HIToolbox                           0x00007fffabd5abf9 ReceiveNextEventCommon + 184
	20  HIToolbox                           0x00007fffabd5ab26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
	21  AppKit                              0x00007fffaa2f3a54 _DPSNextEvent + 1120
	22  AppKit                              0x00007fffaaa6f7ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
	23  Tk                                  0x000000010396c8a1 TkGenerateButtonEvent + 494
	24  Tk                                  0x000000010396cd3b Tk_MacOSXSetupTkNotifier + 861
	25  Tcl                                 0x0000000103841c38 Tcl_DoOneEvent + 317
	26  _tkinter.cpython-36m-darwin.so      0x00000001037b8886 EventHook + 185
	27  Python                              0x0000000100186fc3 my_fgets + 34
	28  Python                              0x0000000100186ec9 PyOS_StdioReadline + 109
	29  Python                              0x0000000100187109 PyOS_Readline + 180
	30  Python                              0x000000010021f45b builtin_input + 1111
	31  Python                              0x00000001001c4f19 _PyCFunction_FastCallDict + 166
	32  Python                              0x00000001002297d7 call_function + 489
	33  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	34  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	35  Python                              0x000000010022a693 fast_function + 227
	36  Python                              0x00000001002297ae call_function + 448
	37  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	38  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	39  Python                              0x000000010022a693 fast_function + 227
	40  Python                              0x00000001002297ae call_function + 448
	41  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	42  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	43  Python                              0x000000010022a693 fast_function + 227
	44  Python                              0x00000001002297ae call_function + 448
	45  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	46  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	47  Python                              0x000000010022a693 fast_function + 227
	48  Python                              0x00000001002297ae call_function + 448
	49  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	50  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	51  Python                              0x000000010022a693 fast_function + 227
	52  Python                              0x00000001002297ae call_function + 448
	53  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	54  Python                              0x000000010022a92e _PyFunction_FastCall + 121
	55  Python                              0x00000001002297ae call_function + 448
	56  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	57  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	58  Python                              0x000000010022a85e _PyFunction_FastCallDict + 444
	59  Python                              0x000000010018d4d9 _PyObject_FastCallDict + 196
	60  Python                              0x000000010018d5fc _PyObject_Call_Prepend + 156
	61  Python                              0x000000010018d35a PyObject_Call + 101
	62  Python                              0x0000000100222825 _PyEval_EvalFrameDefault + 5603
	63  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	64  Python                              0x000000010022a693 fast_function + 227
	65  Python                              0x00000001002297ae call_function + 448
	66  Python                              0x00000001002225ca _PyEval_EvalFrameDefault + 5000
	67  Python                              0x0000000100229fa7 _PyEval_EvalCodeWithName + 1829
	68  Python                              0x00000001002211cd PyEval_EvalCode + 43
	69  Python                              0x0000000100248896 run_mod + 54
	70  Python                              0x0000000100248b76 PyRun_FileExFlags + 180
	71  Python                              0x0000000100248103 PyRun_SimpleFileExFlags + 280
	72  Python                              0x000000010025bd40 Py_Main + 3268
	73  Python                              0x0000000100180e1d Python + 7709
	74  libdyld.dylib                       0x00007fffc1f7a235 start + 1
	75  ???                                 0x0000000000000004 0x0 + 4
), com.apple.ViewBridge.error.description=NSViewBridgeExceptionError}, com.apple.inputmethod.EmojiFunctionRowItem

Expected outcome

I expect my OS to not die because of an idle application.

Matplotlib version

  • Operating System: mac OS 10.12.6
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.1
  • Other Libraries: ipython 6.1.0 and its dependencies updated from pip as of this morning

Note that I switched to TkAgg because the MacOsx backend silently ignores Ctrl-C signal and I needed it for my work. This behaviour does not happen on the MacOsx backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actionthird-party integration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions