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

Browsing through excluded_paths causes "noisy" logs to show #1337

Open
grios-stratio opened this issue Jul 4, 2024 · 0 comments
Open

Browsing through excluded_paths causes "noisy" logs to show #1337

grios-stratio opened this issue Jul 4, 2024 · 0 comments
Labels

Comments

@grios-stratio
Copy link

Description

When configuring the excluded_paths and browsing in the Jupyter lab UI through the excluded paths, the jupyter server logs show a somewhat noisy (since it includes the traceback) message, like this:

2024-07-04 12:32:34 WARNING - 0 handlers write_error:774 wrote error: 'Not Found'
    Traceback (most recent call last):
      File "/home/grios/miniconda3/envs/analytic-4.0/lib/python3.9/site-packages/tornado/web.py", line 1769, in _execute
        result = await result  # type: ignore
      File "/home/grios/miniconda3/envs/analytic-4.0/lib/python3.9/site-packages/jupyterlab_git/handlers.py", line 57, in prepare
        raise tornado.web.HTTPError(404)
    tornado.web.HTTPError: HTTP 404: Not Found

It seems this is caused because the git handler is raising a web.HTTPError(404) in the prepare method:

async def prepare(self):
"""Check if the path should be skipped"""
await ensure_async(super().prepare())
path = self.path_kwargs.get("path")
if path is not None:
excluded_paths = self.git.excluded_paths
for excluded_path in excluded_paths:
if fnmatch.fnmatchcase(path, excluded_path):
raise tornado.web.HTTPError(404)

and the base APIHandler of jupyter_server logs the error with its traceback in the write_error:
https://github.com/jupyter-server/jupyter_server/blob/f2d40f692c29e155349b179d57a454e7f23ea898/jupyter_server/base/handlers.py#L774.

Some time ago (#1165) an error was not raised there and we only had in the logs the less-intrusive message.

2024-07-04 12:32:34 WARNING - 0 log log_request:99 404 POST /git/somepath/show_prefix?1720089154189 (9157f51ccdb94089b5aade51e22a1a68@127.0.0.1) 4.48ms referer=http://localhost:8888/lab/workspaces/auto-B

It would be nice if it no log message was logged (I think the perfect solution would be for the frontend to not make the request in the first place for the excluded paths) or for the message to be less noisy (not raising web.HTTPError? overriding write_error in the handler? 🤔 )

Reproduce

  1. Configure the c.JupyterLabGit.excluded_paths = ["/somepath", "/somepath/*] in jupyter_server_config.py
  2. Launch jupyterlab
  3. Create (if does not exists) a folder in called "somepath" in the workspace.
  4. Browse in the JupyterLab UI through folders inside somepath and the "noisy" log message should appear.

Expected behavior

No log message shown (or at least no traceback)

Context

  • Python package version:
Name: jupyterlab_git
Version: 0.50.1
Summary: A JupyterLab extension for version control using git
Home-page: 
Author: Jupyter Development Team
Author-email: 
License: BSD 3-Clause License
        
        Copyright (c) 2020, Jupyter Development Team
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Location: /home/grios/miniconda3/envs/analytic-4.0/lib/python3.9/site-packages
Requires: jupyter-server, nbdime, nbformat, packaging, pexpect, traitlets
Required-by:
  • Extension version: @jupyterlab/git v0.50.1 enabled OK (python, jupyterlab-git)
  • Git version: git version 2.41.0
  • Operating System and its version: Ubuntu 20.04.6 LTS
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant