question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kernel not restarting sometimes

See original GitHub issue

import tensorflow is one way to reproduce: clip. Further, 4.1.4 prints INFO-level messages (also shown), which didn’t occur in 4.1.3, now needing manually setting os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' to disable.

It also doesn’t always reproduce; still unsure how it works exactly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:23 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
impact27commented, Sep 24, 2022

Fixed by https://github.com/spyder-ide/spyder/pull/19411

If the frontend receives an error while restarting, it will abort. But if the kernel sends an error while closing, then the frontend aborts, even though the new kernel is fine.

1reaction
OverLordGoldDragoncommented, Oct 24, 2020

@ccordoba12 Found a different way to reproduce: importing a compiled .c module (.pyd) and calling its method.

C code
#define PY_SSIZE_T_CLEAN
#include <Python.h>

static PyObject *
spam_system(PyObject *self, PyObject *args)
{
    const char *command;
    int sts;

    if (!PyArg_ParseTuple(args, "s", &command))
        return NULL;
    sts = system(command);
    return PyLong_FromLong(sts);
}

static PyMethodDef SpamMethods[] = {
    {"system",  spam_system, METH_VARARGS,
     "Execute a shell command."},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};

static struct PyModuleDef spammodule = {
    PyModuleDef_HEAD_INIT,
    "spam",   /* name of module */
    NULL,     /* module documentation, may be NULL */
    -1,       /* size of per-interpreter state of the module,
                 or -1 if the module keeps state in global variables. */
    SpamMethods
};

PyMODINIT_FUNC
PyInit_spam(void)
{
    return PyModule_Create(&spammodule);
}
setup.py
from distutils.core import setup, Extension

module1 = Extension('spam',
                    sources = ['spammodule.c'])

setup (name = 'PackageName',
       version = '1.0',
       description = 'This is a demo package',
       ext_modules = [module1])

Run python setup.py build, then drag the proper .pyd out of build so that it’s visible to Python, then in separate .py, run

import spam
spam.system('h')

TensorFlow does import from .pyd, so this might explain the problem (though, wasn’t it working for older TFs? They also import .pyd, but above script actually errors, so maybe it reacts to errors - dunno).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restarting the Jupyter kernel sometimes does not work
The only workaround I have found is to restart DataSpell. Thank you!
Read more >
If your Mac restarts and a message appears - Apple Support
If the faulty software is not identified and your Mac continues to experience kernel panics, try the following: Restart your Mac in safe...
Read more >
Jupyter notebook kernel constantly needs to be restarted
Restarting the kernel is the only solution I've been able to find and that makes development painfully slow. I'm running these versions for ......
Read more >
Mac keeps restarting: how to fix a kernel panic - Setapp
It's not only an outdated system that might cause kernel panic, old and incompatible software is another common issue. The best practice is...
Read more >
How to troubleshoot kernel crashes, hangs, or reboots with ...
... developers who need to reboot a machine often for testing purposes. Using kexec for rebooting into a normal kernel is simple, but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found