jupyterlab / jupyterlab-git

A Git extension for JupyterLab
BSD 3-Clause "New" or "Revised" License
1.46k stars 319 forks source link

Git extension causing issues for Jupyterlab 3.x #970

Closed paravatha closed 2 years ago

paravatha commented 3 years ago

Description

I am seeing this issue mentioned here while using git extension jupyterlab-git version=0.31.0a0 jupyterlab version=3.0.16

https://github.com/jupyterlab/jupyterlab/issues/10435 Raising this issue as per this suggestion: https://github.com/jupyterlab/jupyterlab/pull/10505#issuecomment-873350982

Reproduce

Using git diff is breaking JupyterLab functionality

  1. Open .ipynb image

  2. Do a git diff on a .py file image

  3. this causes .py file is empty image

  4. .ipynb file has empty cells image

Expected behavior

JupyterLab works well till I do git diff. If I restart the server via hub control, it works till I do git diff

Context

Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Web Browser Output
Paste the output from your browser web console here.
welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

fcollonval commented 3 years ago

Hey @paravatha

Thanks for reporting the issue. Couple of questions, what browser are you using? And is there any error in the webbrowser console (help to open it)?

paravatha commented 3 years ago

I am using Chrome on Mac: Google Chrome Version 91.0.4472.114 (Official Build) (x86_64)

Here are the errors from dev tools

image

krassowski commented 3 years ago

Hi @paravatha, I am afraid that it might be too much of the traceback redacted. Could you please try to only redact the part that you don't feel comfortable sharing but preserve any variable names? I can guess that the first error 'uri' of null, document disposed, is_visible failed are coming from the LSP extension (and are likely not related) but I do not understand where are the other errors (listed below) coming from:

Could you please extract the traceback of those and also provide a list of extensions you have installed (jupyter labextension list)?

paravatha commented 3 years ago

@krassowski here we go!

sh-4.2$ pip list | grep jupyter

jupyter                       1.0.0
jupyter-client                6.2.0
jupyter-console               6.1.0
jupyter-core                  4.6.3
jupyter-dash                  0.4.0
jupyter-lsp                   1.4.0
jupyter-resource-usage        0.6.0
jupyter-server                1.9.0
jupyter-server-mathjax        0.2.3
jupyter-telemetry             0.0.5
jupyterhub                    1.1.0
jupyterhub-ldapauthenticator  1.3.0
jupyterlab                    3.1.0b0
jupyterlab-code-formatter     1.4.10
jupyterlab-execute-time       2.0.4
jupyterlab-git                0.31.0a0
jupyterlab-latex              2.0.0
jupyterlab-legos-ui           0.1.5
jupyterlab-lsp                3.8.0
jupyterlab-pygments           0.1.2
jupyterlab-server             2.6.0
jupyterlab-spellchecker       0.6.0
jupyterlab-sublime            0.4.1
jupyterlab-system-monitor     0.8.0
jupyterlab-topbar             0.6.1
jupyterlab-widgets            1.0.0
jupyterthemes                 0.20.0

sh-4.2$ jupyter labextension list

JupyterLab v3.1.0b0
/opt/rh/rh-python36/root/usr/share/jupyter/labextensions
        jupyterlab-jupytext v1.3.3 enabled OK (python, jupytext)
        jupyterlab-plotly v5.1.0 enabled OK
        jupyterlab-system-monitor v0.8.0 enabled OK (python, jupyterlab-system-monitor)
        jupyterlab-topbar-extension v0.6.1 enabled OK (python, jupyterlab-topbar)
        nbdime-jupyterlab v2.1.0 enabled OK
        @dunovank/jupyterlab_legos_ui v0.1.5 enabled OK (python, jupyterlab_legos_ui)
        @ijmbarr/jupyterlab_spellchecker v0.6.0 enabled OK (python, jupyterlab-spellchecker)
        @jupyter-server/resource-usage v0.6.0 enabled OK (python, jupyter-resource-usage)
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.31.0-alpha.0 enabled OK (python, jupyterlab-git)
        @krassowski/jupyterlab-lsp v3.8.0 enabled OK (python, jupyterlab-lsp)
        @ryantam626/jupyterlab_code_formatter v1.4.10 enabled OK (python, jupyterlab-code-formatter)
        @ryantam626/jupyterlab_sublime v0.4.1 enabled OK (python, jupyterlab_sublime)

Other labextensions (built into JupyterLab)
   app dir: /opt/rh/rh-python36/root/usr/share/jupyter/lab
        @jupyterlab/debugger v3.0.12 enabled OK
        @jupyterlab/toc v5.0.12 enabled OK
        jupyterlab-dash v0.4.0 enabled OK

Error trace after git diff

Uncaught (in promise) TypeError: t.iter is not a function
    at Wi (/user/testuser/static/lab/4631.c3a48e5d19fbbe670a68.js?v=c3a48e5d19fbbe670a68:1)
    at yo (/user/testuser/static/lab/4631.c3a48e5d19fbbe670a68.js?v=c3a48e5d19fbbe670a68:1)
    at new Ea (/user/testuser/static/lab/4631.c3a48e5d19fbbe670a68.js?v=c3a48e5d19fbbe670a68:1)
    at Ea (/user/testuser/static/lab/4631.c3a48e5d19fbbe670a68.js?v=c3a48e5d19fbbe670a68:1)
    at new $ (/user/testuser/lab/extensions/@jupyterlab/git/static/197.54a4c128136fe4bf4459.js?v=54a4c128136fe4bf4459:1)
    at le.createDiffView (/user/testuser/lab/extensions/@jupyterlab/git/static/197.54a4c128136fe4bf4459.js?v=54a4c128136fe4bf4459:1)
    at /user/testuser/lab/extensions/@jupyterlab/git/static/197.54a4c128136fe4bf4459.js?v=54a4c128136fe4bf4459:1
codemirror.js:8606 Uncaught TypeError: this.doc.iter is not a function
    at Ea.<anonymous> (codemirror.js:8606)
    at Ea.setSize (codemirror.js:3947)
    at Wl (codemirror.js:6653)
    at codemirror.js:6625
    at An (codemirror.js:3929)
    at Ea.operation (codemirror.js:8615)
    at Nl (codemirror.js:6624)
    at codemirror.js:6641

Error trace after opening .py file

index.es6.js:211 TypeError: n is not a function
    at s (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at m (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.l [as emit] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.emit (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at se.disconnect (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at se.dispose (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at m (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.l [as emit] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.emit (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at y.e.dispose (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
e.exceptionHandler @ index.es6.js:211
12364.9d480cbdf22d4a4b738a.js:1 LSP: is_visible failed TypeError: Cannot read property 'content' of null
    at se.context_from_active_document (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at ce.get_context (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at ce.is_visible (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at isVisible (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at e.isVisible (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.get [as isVisible] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at l (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.o [as search] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at t.onUpdateRequest (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at t.e.processMessage (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
is_visible @ 364.9d480cbdf22d4a4b738a.js:1
12364.9d480cbdf22d4a4b738a.js:1 LSP: is_visible failed TypeError: Cannot read property 'document_at_root_position' of undefined
    at se.get_context (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at se.context_from_active_document (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at ce.get_context (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at ce.is_visible (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at isVisible (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at e.isVisible (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.get [as isVisible] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at l (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.o [as search] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at t.onUpdateRequest (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
is_visible @ 364.9d480cbdf22d4a4b738a.js:1
2index.es6.js:211 TypeError: Cannot read property 'uri' of null
    at Pt.handleDiagnostic (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at m (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.l [as emit] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.emit (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/jupyter-lsp-connection.4e7198450c963fe11bba.js:1
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at p (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2)

Error trace after opening .ipynb file

364.9d480cbdf22d4a4b738a.js:1 LSP: is_visible failed TypeError: Cannot read property 'model' of undefined
    at ae.context_from_active_document (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at ce.get_context (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at ce.is_visible (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at isVisible (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at e.isVisible (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.get [as isVisible] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at l (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.o [as search] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at t.onUpdateRequest (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at t.e.processMessage (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
is_visible @ 364.9d480cbdf22d4a4b738a.js:1
3default.js:66 Starting WebSocket: wss://aaocp4-extjul6-testuser-air9-jpr.apps.aws-useast1-datalake-dev-1.dlk-dev.us-east-1.ac.discoverfinancial.com/user/testuser/api/kernels/0790cadc-0411-44ce-808b-27ef7aba740a
2index.es6.js:211 TypeError: Cannot read property 'uri' of null
    at Pt.handleDiagnostic (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/364.9d480cbdf22d4a4b738a.js:1)
    at m (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at Object.l [as emit] (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at e.emit (/user/testuser/static/lab/jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2)
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/jupyter-lsp-connection.4e7198450c963fe11bba.js:1
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at /user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2
    at p (/user/testuser/lab/extensions/@krassowski/jupyterlab-lsp/static/732.11ddc270aee728503ab8.js:2)
e.exceptionHandler @ index.es6.js:211
jlab_core.3aafbe3f581cc40f2153.js?v=3aafbe3f581cc40f2153:2 [Violation] 'requestAnimationFrame' handler took 57ms
krassowski commented 3 years ago

Thank you! Does it happen on diffing every file, or only for some specific files?

krassowski commented 3 years ago

Also, to rule out the fault of jupyterlab-lsp, would it be possible for you to temporarily uninstall it and check if it still happens without it?

paravatha commented 3 years ago

Thank you! Does it happen on diffing every file, or only for some specific files?

Tried with md, py and ipynb files. Same issue!

paravatha commented 3 years ago

Also, to rule out the fault of jupyterlab-lsp, would it be possible for you to temporarily uninstall it and check if it still happens without it?

Will try today

paravatha commented 3 years ago

@krassowski @fcollonval Removed jupyterlab-lsp and jupyter-lsp. Still seeing the issue

sh-4.2$ jupyter labextension list

JupyterLab v3.1.0b0
/opt/rh/rh-python36/root/usr/share/jupyter/labextensions
        jupyterlab-jupytext v1.3.3 enabled OK (python, jupytext)
        jupyterlab-plotly v5.1.0 enabled OK
        jupyterlab-system-monitor v0.8.0 enabled OK (python, jupyterlab-system-monitor)
        jupyterlab-topbar-extension v0.6.1 enabled OK (python, jupyterlab-topbar)
        nbdime-jupyterlab v2.1.0 enabled OK
        @dunovank/jupyterlab_legos_ui v0.1.5 enabled OK (python, jupyterlab_legos_ui)
        @ijmbarr/jupyterlab_spellchecker v0.6.0 enabled OK (python, jupyterlab-spellchecker)
        @jupyter-server/resource-usage v0.6.0 enabled OK (python, jupyter-resource-usage)
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.31.0-alpha.0 enabled OK (python, jupyterlab-git)
        @ryantam626/jupyterlab_code_formatter v1.4.10 enabled OK (python, jupyterlab-code-formatter)
        @ryantam626/jupyterlab_sublime v0.4.1 enabled OK (python, jupyterlab_sublime)

Other labextensions (built into JupyterLab)
   app dir: /opt/rh/rh-python36/root/usr/share/jupyter/lab
        @jupyterlab/debugger v3.0.12 enabled OK
        @jupyterlab/toc v5.0.12 enabled OK
        jupyterlab-dash v0.4.0 enabled OK

sh-4.2$ pip list | grep jupyter

jupyter                       1.0.0
jupyter-client                6.2.0
jupyter-console               6.1.0
jupyter-core                  4.6.3
jupyter-dash                  0.4.0
jupyter-resource-usage        0.6.0
jupyter-server                1.9.0
jupyter-server-mathjax        0.2.3
jupyter-telemetry             0.0.5
jupyterhub                    1.1.0
jupyterhub-ldapauthenticator  1.3.0
jupyterlab                    3.1.0b0
jupyterlab-code-formatter     1.4.10
jupyterlab-execute-time       2.0.4
jupyterlab-git                0.31.0a0
jupyterlab-latex              3.0.0
jupyterlab-legos-ui           0.1.5
jupyterlab-pygments           0.1.2
jupyterlab-server             2.6.0
jupyterlab-spellchecker       0.6.0
jupyterlab-sublime            0.4.1
jupyterlab-system-monitor     0.8.0
jupyterlab-topbar             0.6.1
jupyterlab-widgets            1.0.0
jupyterthemes                 0.20.0

error trace with git diff on .md file

codemirror.js:2954 Uncaught (in promise) TypeError: t.iter is not a function
    at Wi (codemirror.js:2954)
    at yo (codemirror.js:4794)
    at new Ea (codemirror.js:7900)
    at Ea (codemirror.js:7854)
    at new $ (197.54a4c128136fe4bf…4c128136fe4bf4459:1)
    at le.createDiffView (197.54a4c128136fe4bf…4c128136fe4bf4459:1)
    at 197.54a4c128136fe4bf…4c128136fe4bf4459:1
codemirror.js:8606 Uncaught TypeError: this.doc.iter is not a function
    at Ea.<anonymous> (codemirror.js:8606)
    at Ea.setSize (codemirror.js:3947)
    at Wl (codemirror.js:6653)
    at codemirror.js:6625
    at An (codemirror.js:3929)
    at Ea.operation (codemirror.js:8615)
    at Nl (codemirror.js:6624)
    at codemirror.js:6641



error trace when I open .md file

Uncaught (in promise) TypeError: t.iter is not a function
    at Wi (codemirror.js:2954)
    at yo (codemirror.js:4794)
    at new Ea (codemirror.js:7900)
    at Ea (codemirror.js:7854)
    at new $ (197.54a4c128136fe4bf4459.js?v=54a4c128136fe4bf4459:1)
    at le.createDiffView (197.54a4c128136fe4bf4459.js?v=54a4c128136fe4bf4459:1)
    at 197.54a4c128136fe4bf4459.js?v=54a4c128136fe4bf4459:1
codemirror.js:8606 Uncaught TypeError: this.doc.iter is not a function
    at Ea.<anonymous> (codemirror.js:8606)
    at Ea.setSize (codemirror.js:3947)
    at Wl (codemirror.js:6653)
    at codemirror.js:6625
    at An (codemirror.js:3929)
    at Ea.operation (codemirror.js:8615)
    at Nl (codemirror.js:6624)
    at codemirror.js:6641
(anonymous) @ codemirror.js:8606
(anonymous) @ codemirror.js:3947
Wl @ codemirror.js:6653
(anonymous) @ codemirror.js:6625
An @ codemirror.js:3929
operation @ codemirror.js:8615
Nl @ codemirror.js:6624
(anonymous) @ codemirror.js:6641
codemirror.js:8606 Uncaught TypeError: this.doc.iter is not a function
    at Ea.<anonymous> (codemirror.js:8606)
    at Ea.setSize (codemirror.js:3947)
    at Wl (codemirror.js:6653)
    at codemirror.js:6625
    at An (codemirror.js:3929)
    at Ea.operation (codemirror.js:8615)
    at Nl (codemirror.js:6624)
    at codemirror.js:6641
fcollonval commented 3 years ago

I fail to reproduce it. Could you try installing only jupyterlab-git extension to see if it happens too? For now I guess there is a complex interaction between some extensions.

krassowski commented 3 years ago

Trying with the most recent JupyterLab beta might also help. I saw some strange issues in late alpha/early beta, but the cells rendering was already fixed so the latest beta might do the trick.

paravatha commented 3 years ago

@krassowski I tried a different approach Removed all lsp packages and it resolved the issue. and I upgraded to the latest rc jupyterlab (3.1.0rc1)

sh-4.2$ pip list | grep jupyter

jupyter                       1.0.0
jupyter-client                6.2.0
jupyter-console               6.1.0
jupyter-core                  4.6.3
jupyter-resource-usage        0.6.0
jupyter-server                1.9.0
jupyter-server-mathjax        0.2.3
jupyter-telemetry             0.0.5
jupyterhub                    1.1.0
jupyterhub-ldapauthenticator  1.3.0
jupyterlab                    3.1.0rc1
jupyterlab-execute-time       2.0.5
jupyterlab-git                0.31.0a0
jupyterlab-server             2.6.1
jupyterlab-system-monitor     0.8.0
jupyterlab-topbar             0.6.1
jupyterlab-widgets            2.0.0a2

sh-4.2$ jupyter labextension list

JupyterLab v3.1.0rc1
/opt/rh/rh-python36/root/usr/share/jupyter/labextensions
        jupyterlab-execute-time v2.0.5 enabled OK (python, jupyterlab_execute_time)
        jupyterlab-plotly v5.1.0 enabled OK
        jupyterlab-system-monitor v0.8.0 enabled OK (python, jupyterlab-system-monitor)
        jupyterlab-topbar-extension v0.6.1 enabled OK (python, jupyterlab-topbar)
        nbdime-jupyterlab v2.1.0 enabled OK
        @jupyter-server/resource-usage v0.6.0 enabled OK (python, jupyter-resource-usage)
        @jupyter-widgets/jupyterlab-manager v4.0.0-alpha.2 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.31.0-alpha.0 enabled OK (python, jupyterlab-git)

Other labextensions (built into JupyterLab)
   app dir: /opt/rh/rh-python36/root/usr/share/jupyter/lab
        @jupyterlab/debugger v3.0.12 enabled OK
        @jupyterlab/toc v5.0.12 enabled OK
paravatha commented 3 years ago

it seems like lsp and git are not working well together.. and its causing issue for git extension

paravatha commented 3 years ago

@krassowski @fcollonval were you able to recreate this issue?

fcollonval commented 3 years ago

@paravatha

I'm unable to reproduce it unfortunately - packages used:

pip list | grep jupyter
jupyter-client                6.1.12
jupyter-core                  4.7.1
jupyter-lsp                   1.4.0
jupyter-server                1.10.1
jupyter-server-mathjax        0.2.3
jupyterlab                    3.0.16
jupyterlab-git                0.31.0
jupyterlab-lsp                3.8.0
jupyterlab-pygments           0.1.2
jupyterlab-server             2.6.1
jupyter server extension list
Config dir: /home/fcollonval/.jupyter

Config dir: /home/fcollonval/miniconda3/envs/tgit/etc/jupyter
    jupyter_lsp enabled
    - Validating jupyter_lsp...
      jupyter_lsp 1.4.0 OK
    jupyter_server_mathjax enabled
    - Validating jupyter_server_mathjax...
      jupyter_server_mathjax  OK
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 3.0.16 OK
    jupyterlab_git enabled
    - Validating jupyterlab_git...
      jupyterlab_git 0.31.0 OK
    nbclassic enabled
    - Validating nbclassic...
      nbclassic  OK
    nbdime enabled
    - Validating nbdime...
      nbdime 3.1.0 OK
JupyterLab v3.0.16
/home/fcollonval/miniconda3/envs/tgit/share/jupyter/labextensions
        nbdime-jupyterlab v2.1.0 enabled OK
        @krassowski/jupyterlab-lsp v3.8.0 enabled OK (python, jupyterlab-lsp)
        @jupyterlab/git v0.31.0 enabled OK (python, jupyterlab-git)
fcollonval commented 3 years ago

One strange thing, you got those JupyterLab extensions listed:

Other labextensions (built into JupyterLab)
   app dir: /opt/rh/rh-python36/root/usr/share/jupyter/lab
        @jupyterlab/debugger v3.0.12 enabled OK
        @jupyterlab/toc v5.0.12 enabled OK

They should not be reported as they are built-in in JupyterLab. I strongly advice you remove them.

krassowski commented 3 years ago

I was not able to replicate this either:

$ jupyter labextension list
JupyterLab v3.1.0rc2
/**/share/jupyter/labextensions
        nbdime-jupyterlab v2.1.0 enabled OK
        spreadsheet-editor v0.6.0 enabled OK (python, jupyterlab-spreadsheet-editor)
        @jupyter-server/resource-usage v0.6.0 enabled OK (python, jupyter-resource-usage)
        @deathbeds/ipydrawio-webpack v14.7.100 enabled OK (python, ipydrawio)
        @deathbeds/ipydrawio v1.1.0 enabled OK (python, ipydrawio)
        @deathbeds/ipydrawio-notebook v1.1.0 enabled OK (python, ipydrawio)
        @ijmbarr/jupyterlab_spellchecker v0.6.0 enabled OK (python, jupyterlab-spellchecker)
        @jupyterlab/git v0.31.0 enabled OK (python, jupyterlab-git)
        @krassowski/jupyterlab-lsp v3.8.0 enabled OK (python, jupyterlab-lsp)
        @jupyter-widgets/jupyterlab-sidecar v0.6.1 enabled OK (python, sidecar)
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)

In addition to removing the two extensions listed in comment above you could try to narrow it down by creating a fresh virtual environment and installing the extensions one by one, running a new JupyterLab instance after each new installation and checking which one is the culprit.

paravatha commented 3 years ago

@krassowski @fcollonval thanks for your suggestion. I tried it, but still no luck. I updated to these stable vesions

jupyterlab==3.1.0
jupyterlab-git==0.31.0

One additional things I noticed, the diff works fine with ipynb files and ipynb files render fine. The issue seems to be occurring while doing diff on file types other than .ipynb (I tried .md or .py files).

paravatha commented 3 years ago

@krassowski @fcollonval it works after I removed these 3 jupyter extensions

jupyterlab-sublime  
jupyterlab-latex   
jupytext

My guess one of these extensions are not working well with other extensions

thanks for your suggestions, closing this

paravatha commented 3 years ago

For posterity (in-case others run into this issue), here are all the jupyter packages I have installed

sh-4.2$ pip list | grep jupy

jupyter                       1.0.0
jupyter-client                6.2.0
jupyter-console               6.1.0
jupyter-core                  4.6.3
jupyter-dash                  0.4.0
jupyter-lsp                   1.4.1
jupyter-resource-usage        0.6.0
jupyter-server                1.10.2
jupyter-server-mathjax        0.2.3
jupyter-telemetry             0.0.5
jupyterhub                    1.1.0
jupyterhub-ldapauthenticator  1.3.0
jupyterlab                    3.1.4
jupyterlab-code-formatter     1.4.10
jupyterlab-execute-time       2.0.5
jupyterlab-git                0.32.0
jupyterlab-lsp                3.8.1
jupyterlab-pygments           0.1.2
jupyterlab-server             2.6.2
jupyterlab-spellchecker       0.7.0
jupyterlab-system-monitor     0.8.0
jupyterlab-topbar             0.6.1
jupyterlab-widgets            1.0.0
fcollonval commented 3 years ago

Thanks for reporting back your investigation @paravatha

krassowski commented 2 years ago

I encountered issues today which went away after uninstalling jupytext.

I'm able to replicate on Binder: https://gist.github.com/krassowski/c8921d090fec969b00bd9b1e6f01d5bf

First on loading the following error is shown (this might be unrelated):

Screenshot from 2021-11-24 13-14-13

Then to reproduce:

  1. Open test.py (a tracked file)
  2. Edit the code in test.py and save it
  3. Open Git panel and diff test.py

See that the diff does not render and the following error is shown:

Screenshot from 2021-11-24 13-18-21

```ts Uncaught (in promise) TypeError: t.iter is not a function at Wi (4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:3268) at yo (4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:5215) at new Ea (4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:9038) at Ea (4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:8990) at new V (462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1) at 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 at le.createDiffView (462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1) at 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 Wi @ 4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:3268 yo @ 4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:5215 Ea @ 4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:9038 Ea @ 4631.96a143e70f005fef7b59.js?v=96a143e70f005fef7b59:formatted:8990 V @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 (anonymous) @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 createDiffView @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 (anonymous) @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 Promise.then (async) onAfterAttach @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 e.processMessage @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 b @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 t @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 t.attachWidget @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 t.insertWidget @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 t.addWidget @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 t.addWidget @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 execute @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 await in execute (async) e.execute @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 execute @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 e.execute @ jlab_core.8254cd1e48acf4f1b11e.js?v=8254cd1e48acf4f1b11e:2 _openDiffView @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 onClick @ 462.a64c182a8d9f8befd178.js?v=a64c182a8d9f8befd178:1 qe @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 Je @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 en @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 Yr @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 Xr @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 (anonymous) @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 Ae @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 We @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 tl @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 ft @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 ct @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 n.unstable_runWithPriority @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 ha @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 Fe @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 it @ 3935.e00facce2e55a4af6e62.js?v=e00facce2e55a4af6e62:2 ```

Which happens in:

Screenshot from 2021-11-24 13-19-37

``` function Wi(e) { var t = e.doc , r = Di(e); t.iter((function(e) { var t = r(e); if (t != e.height) { Je(e, t) } } )) } ```

This is not in jupyterlab-git codebase - it is in CodeMirror. The last place in jupyterlab-git codebase in the traceback is:

Screenshot from 2021-11-24 13-22-26

called from createDiffView. This corresponds to the following part of the codebase:

https://github.com/jupyterlab/jupyterlab-git/blob/e6702391b96af760b39858bef96f17aef4e61e7f/src/components/diff/mergeview.ts#L1164-L1182

Should we reopen this one?

In addition to the main mode of failure reported above the following was also seen as a consequence locally but not on binder:

Uncaught TypeError: Cannot read properties of undefined (reading 'state')
    at Function.syncScroll (:8892/lab/extensions/@jupyterlab/git/static/2.0c2a062310541869d53b.js?v=0c2a062310541869d53b:1)
    at Function.setScrollLock (:8892/lab/extensions/@jupyterlab/git/static/2.0c2a062310541869d53b.js?v=0c2a062310541869d53b:1)
    at HTMLDivElement.<anonymous> (:8892/lab/extensions/@jupyterlab/git/static/2.0c2a062310541869d53b.js?v=0c2a062310541869d53b:1)

Any ideas what might be going on? CC @mwouts

fcollonval commented 2 years ago

Thanks @krassowski

I'll reopen this

krassowski commented 2 years ago

Thanks! Probably also worth renaming to "Jupytext interferes with git extension in 3.x".

mwouts commented 2 years ago

Hi, thanks for the mention, well sorry no I see no obvious explanation. But I am not at all an expert of TS/JS, so maybe you can help me determine how it can cause this? (the good news is that the Jupytext extension is only 360 lines long)

fcollonval commented 2 years ago

As the current version of a file (aka the working version) is obtained through the Jupyter server content manager at https://github.com/jupyterlab/jupyterlab-git/blob/961e1213863f2faed4554a68c6cf0c317cce0f23/jupyterlab_git/git.py#L1303

My guess is that the file served by Jupytext is containing some information that confuse the Git extension. A good start will be to look (for a simple .py file) at the response of the git/content request of the challenger version when opening a diff panel.

paravatha commented 2 years ago

@krassowski @fcollonval

I ran into the issue again with a different set of extensions (other than jupytext) My git diff was hanging. So, removed these extensions, and git diff works now

REMOVED

jupyterlab-topbar jupyterlab_execute_time jupyterlab-system-monitor jupyter-dash jupyterlab-logout jupyterthemes

Here is my working setup Python 3.8.11 git 2.9.3 node 14.17.5 npm 6.14.14 RHEL 7.9

sh-4.2$ pip list | grep -i jupyter jupyter-client 7.1.0 jupyter-console 6.4.0 jupyter-core 4.9.1 jupyter-lsp 1.5.1 jupyter-resource-usage 0.6.1 jupyter-server 1.13.1 jupyter-server-mathjax 0.2.3 jupyter-telemetry 0.1.0 jupyterhub 1.5.0 jupyterhub-ldapauthenticator 1.3.2 jupyterlab 3.2.5 jupyterlab-code-formatter 1.4.10 jupyterlab-git 0.34.0 jupyterlab-lsp 3.9.3 jupyterlab-pygments 0.1.2 jupyterlab-server 2.10.1 jupyterlab-spellchecker 0.7.2 jupyterlab-widgets 1.0.2

JeffSaxeVA commented 2 years ago

Hi, Frédéric @fcollonval . I have more information on this problem, which is afflicting my end users now.

I'm the same user who reported issue #940 with the "top_repo_path" causing problems with paths downward (relative to the user's home folder) that happened to symlink up and out of the Jupyter root. You kindly checked in PR #939 to address several bugs, and you suspected it fixed that issue as well, although I wasn't able to test it at the time. Now I have a second JupyterHub / JupyterLab installation, and I've started with the latest versions of everything, so it has jupyterlab-git 0.34.2 running in JupyterLab 3.3.0, with Jupytext 1.13.7. I have the same symptom from this issue, namely: If I use visual Git Diff on a .ipynb file, it works fine and opens with the red / green diffs as desired. However, our end users prefer to .gitignore the .ipynb files (because of superfluous differences in their output cells) and only concentrate on diff'ing the associated .md files for commits, and when I try to visual Git Diff one of those, it opens the new Lab tab but with no actual contents, and also all input cells of all Python notebooks in the Lab start to malfunction, either not allowing me to type or showing up empty (as @paravatha reported). Mouse works, but keyboard is useless within Python input cells, until I reload the browser and refresh my view of Lab; then everything works until I try to Git Diff a .md file again.

I was able to force this to work by downgrading jupyterlab-git to the version that was before that top_repo_path fix, version 0.30.1, still thankfully available via conda-forge. In this environment I have not downgraded JupyterLab itself (still 3.3.0), nor Jupytext (still 1.13.7), nor JupyterHub (happens to be 1.5.0), and I happen to have jupyterlab-topbar and jupyterlab_execute_time and jupyterlab-system-monitor, all popular extensions that my end users like to have installed. The only thing that made Git Diff work was downgrading to last May's jupyterlab-git, which obviously will be losing a number of other released enhancements and fixes. My hope is that my careful observation of Chrome Dev Tools for the git/content requests will help you figure out the root cause and get it 100% working. Sorry for being long-winded in text and not including screenshots, but my locked-down environment is awkward to copy-paste images out of.

You speculated in your comment from 2021-11-29 above that it might have something to do with the response to the challenger URL, and I agree with you. In the older 0.30.1 version of jupyterlab-git, the first of the two requests is a JSON naming the filename, the reference (git: "HEAD"), and the top_repo_path; the second request is a similar JSON, just changing the reference to either special: "WORKING" (if it's in the Changed section) or special: "INDEX" (if it's been moved up to Staged). Importantly, the two response bodies coming back from the server in each case are exactly the same format, whether I'm asking for a Git Diff of a .ipynb or a .md: It's a JSON structure with a single element named "content", which is then one very long, quoted string containing the content of the requested file, with appropriate escaping of newlines and embedded quote marks to be able to pass within that quoted string. If the compared file is a .ipynb, then the "content" string is itself a string of a JSON, the long structure that a Jupyter notebook contains, but it's all returned as a single string. If the compared file is a .md, then the "content" string does not contain a nested JSON -- it's Jupytext text format, so a YAML indented file, again escaped so that the newlines are fully contained in the outer "content" string. Either of these cases (.ipynb and .md) can then be fed into the left-right Compare window and produce decent output in both cases.

However, in the 0.31 and later versions which break Git Diff, the bodies returned from the two git/content calls now show a format inconsistency. The first call for the HEAD version correctly returns the long quoted string in the single field "content". But the WORKING or INDEX version from the second call seems to return the raw content without being string-encapsulated. If that second call is for the challenger version of an .ipynb file, then the reply is a JSON structure with one element, "content", but its contents are directly the JSON of notebook file, not a stringified encap of that JSON. Despite one being a raw JSON structure and the other a string of a (similar) JSON structure, the Compare window appears to be able to smooth other this inconsistency and render the diff properly. But if the second call is for a .md file, then the reply to the second call is a full JSON structure, basically a "rehydrated" Notebook file, I believe the same thing as the user would get if he pulled the Markdown file out of source control without the corresponding Notebook file next to it, and selected "Open With Notebook" (which is how our end users are trained to work). So in this case, the Compare window cannot handle being asked to compare a quoted string version of a YAML versus a non-quoted version of a JSON of the original notebook, and it chokes.

So I agree with you that this is some interaction between having Jupytext installed and using JupyterLab-Git to perform the Diff, but I expect the problem is something internal to the retrieval of that second challenger URL. I believe that the Jupytext extension inserts a shim into the api/contents/filename call that is able to rehydrate a notebook out of the slimmed-down MD file on command; I can see it in my Dev Tools. If I double-click the .md file itself (by mistake), then I get a plaintext editor editing the Markdown, not usually what I want, but the call is to api/contents/filename?type=file&content=1&format=text, which retrieves the plaintext contents. If I right-click the MD file and do "Open with Notebook", then I see two api/contents calls in quick succession: the first with content=0 seemingly just verifying the metadata of the original file, which returns a "content" field of NULL and a "type" field naming "notebook", and then a second call with type=notebook&content=1, which rehydrates / synthesizes the JSON content of the original .ipynb file without its output cells and returns it as the "content" field, with a "format" of "json" in the response body.

I'm guessing that, starting with 0.31, the second call to git/content is then performing a call under the table to api/contents that is missing a format specifier, or assuming a type specifier, or leaving off a pass-through argument, something... and in every case (.ipynb or .md), this is resulting in the second call producing a raw JSON doc instead of the string encap of that JSON doc. This in turn is being (luckily?) papered over by the Compare window for the .ipynb case, but it's too far out of alignment for handling in the .md case. I don't have enough skill in reading the JavaScript to point you to exactly where this might be happening, but I sincerely hope this is a precise enough description that you can find it.

Cheers, and thanks for working on this essential extension!

JeffSaxeVA commented 2 years ago

Just checking in, @fcollonval . Is this a symptom you see a way to fix? I'm trying to be more of a helpful contributor, rather than just a complaining end user, so here goes:

The Handler for git/content appears to call get_content_at_reference, currently at git.py line 1315. This function has some if-else logic cases, and depending on the conditions, it might return the result of self.show, in the case of the git: HEAD, or the result of self.get_content, in the case of special: WORKING. self.show appears to basically just copy out the result of the "git show" CLI command (line 1287), which I imagine will be a straight-up string in all cases. self.get_content appears to call the contents_manager.get method, and then assuming no error, it plucks out the "content" field from model and returns that (line 1313). I don't know where to go further to search for the implementation of contents_manager.get, but is there some way to pass a "format=text" parameter into this call on line 1384, so that Jupytext will return the raw text and refrain from rehydrating the Notebook as JSON?

fcollonval commented 2 years ago

@JeffSaxeVA 0.36.0 release that should fix this issue is in process (conda package will likely be available in a couple of hours). Thanks for the patience

JeffSaxeVA commented 2 years ago

@fcollonval Confirmed, this fixes the issue! We are now able to diff .md, .py, and .ipynb files, no problem, and I can see that in all cases, for both the reference and challenger git/content calls, the response body is uniformly a single JSON with a single field "content", whose value is just a long quoted string.

Thanks so much for fixing it! And also thanks for checking in a test covering it, to ensure sure this symptom doesn't sneak in in future. Very complete.

GabeChurch commented 1 year ago

FYI for anyone using z2jh that runs into this when running on Kubernetes (running JH < 3 and Jupyterlab 3X), you need to change the launch command under "singleuser" in helm charts to "cmd: jupyter-labhub" to fix this, in addition to ensuring you have the appropriate permissions.