Repository: wandb/wandb

Issue:
[CLI]: SystemMonitor thread starting new thread, None as the result
### Describe the bug

Kernel run by jupyter/jupyter-lab. Login succesfull. Run was logged on wandb.ai - I hope that without distortions.
Happens on first run and any next. 


```
Exception in thread SystemMonitor:
Traceback (most recent call last):
  File "/home/mkurtys/.pyenv/versions/3.10.9/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/mkurtys/.pyenv/versions/3.10.9/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mkurtys/.pyenv/versions/3.10.9/envs/torch/lib/python3.10/site-packages/wandb/sdk/internal/system/system_monitor.py", line 118, in _start
    asset.start()
  File "/home/mkurtys/.pyenv/versions/3.10.9/envs/torch/lib/python3.10/site-packages/wandb/sdk/internal/system/assets/cpu.py", line 166, in start
    self.metrics_monitor.start()
  File "/home/mkurtys/.pyenv/versions/3.10.9/envs/torch/lib/python3.10/site-packages/wandb/sdk/internal/system/assets/interfaces.py", line 168, in start
    logger.info(f"Started {self._process.name}")
AttributeError: 'NoneType' object has no attribute 'name'
Exception in thread SystemMonitor:
Traceback (most recent call last):
  File "/home/mkurtys/.pyenv/versions/3.10.9/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/mkurtys/.pyenv/versions/3.10.9/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mkurtys/.pyenv/versions/3.10.9/envs/torch/lib/python3.10/site-packages/wandb/sdk/internal/system/system_monitor.py", line 118, in _start
    asset.start()
  File "/home/mkurtys/.pyenv/versions/3.10.9/envs/torch/lib/python3.10/site-packages/wandb/sdk/internal/system/assets/cpu.py", line 166, in start
    self.metrics_monitor.start()
  File "/home/mkurtys/.pyenv/versions/3.10.9/envs/torch/lib/python3.10/site-packages/wandb/sdk/internal/system/assets/interfaces.py", line 168, in start
    logger.info(f"Started {self._process.name}")
AttributeError: 'NoneType' object has no attribute 'name'
```


### Additional Files

_No response_

### Environment

WandB version: wandb==0.13.9

OS: x86_64 GNU/Linux

Python version: Python 3.10.9  [GCC 12.2.0] on linux

Versions of relevant libraries:


### Additional Context

_No response_


Discussion:
I have the exact same issue!
Hi, thank you both for writing in! Can you give me more information as to how you are running into this issue? For example the script you are running when this appears and your debug logs found in your wandb run directory will be a good start.
It happens asynchronously few seconds after init. No ERROR in debug logs though.
I am also seeing this error. Happens in an ipynb

```
# Indicate the correct mode for this run based on the toggle
wandb_mode = "online" if use_wandb else "disabled"

# Initialize WandB appropriately (do not change)
wandb.init(project="label-functions",
           entity="test_entity",
           mode = wandb_mode)
```

When I run the next cell which contains code unrelated to wandb (loading a csv file), I get the following message. My unrelated code is still able to run.
```
Exception in thread SystemMonitor:
Traceback (most recent call last):
  File "<my conda env path>/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "<my conda env path>/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "<my conda env path>/lib/python3.8/site-packages/wandb/sdk/internal/system/system_monitor.py", line 118, in _start
    asset.start()
  File "<my conda env path>/lib/python3.8/site-packages/wandb/sdk/internal/system/assets/cpu.py", line 166, in start
    self.metrics_monitor.start()
  File "<my conda env path>/lib/python3.8/site-packages/wandb/sdk/internal/system/assets/interfaces.py", line 168, in start
    logger.info(f"Started {self._process.name}")
AttributeError: 'NoneType' object has no attribute 'name'
```

wandb, version 0.13.9

OS: Ubuntu 18.04.5 LTS (Bionic Beaver)

Python 3.8.13


Hi! I'm having the same issue.

**Describe the bug:**
wandb on Jupyter notebook, on a PaperSpace Instance doesn't run.

An error is shown when running a code cell (with not wandb related code) after run a wandb initialization code.

**Error:**
```
Exception in thread SystemMonitor:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/dist-packages/wandb/sdk/internal/system/system_monitor.py", line 118, in _start
    asset.start()
  File "/usr/local/lib/python3.9/dist-packages/wandb/sdk/internal/system/assets/gpu.py", line 355, in start
    self.metrics_monitor.start()
  File "/usr/local/lib/python3.9/dist-packages/wandb/sdk/internal/system/assets/interfaces.py", line 168, in start
    logger.info(f"Started {self._process.name}")
AttributeError: 'NoneType' object has no attribute 'name'
```

NVIDIA-SMI 510.73.05    Driver Version: 510.73.05    CUDA Version: 11.6
Quadro RTX 5000
Running on a PaperSpace Instance

**wandb version: wandb-0.13.9
Python version: Python 3.9.13**

This cell is executed successfully:

```
import wandb
from wandb.keras import WandbCallback

wandb.init(project=wandb_project_name)

wandb_callback = WandbCallback(monitor='val_loss', mode='min', log_gradients=False,save_model=False)
```

The error is produced when running 2 cells after the call to wandb.init

Note:
The same code .ipynb file is excecuted on Google Colab and it runs without problem.
I'm attaching the logs files from wandb.

Thanks.

[debug-internal (1).log](https://github.com/wandb/wandb/files/10670419/debug-internal.1.log)
[debug.log](https://github.com/wandb/wandb/files/10670420/debug.log)
[debug-internal.log](https://github.com/wandb/wandb/files/10670421/debug-internal.log)
[debug (1).log](https://github.com/wandb/wandb/files/10670422/debug.1.log)

Might be related to jupyter-server/jupyter_server#1198
Hi everyone! We'll have a fix soon for this issue. [Here is the PR](https://github.com/wandb/wandb/pull/4899) our team is working on at the moment which will fix the above-mentioned issue as well.

Resolving patch:
diff --git a/wandb/sdk/internal/system/assets/interfaces.py b/wandb/sdk/internal/system/assets/interfaces.py
--- a/wandb/sdk/internal/system/assets/interfaces.py
+++ b/wandb/sdk/internal/system/assets/interfaces.py
@@ -179,6 +179,7 @@ def start(self) -> None:
         if (self._process is not None) or self._shutdown_event.is_set():
             return None
 
+        thread_name = f"{self.asset_name[:15]}"  # thread names are limited to 15 chars
         try:
             for metric in self.metrics:
                 if isinstance(metric, SetupTeardown):
@@ -186,25 +187,26 @@ def start(self) -> None:
             self._process = threading.Thread(
                 target=self.monitor,
                 daemon=True,
-                name=self.asset_name,
+                name=thread_name,
             )
             self._process.start()
-            logger.info(f"Started {self.asset_name} monitoring")
+            logger.info(f"Started {thread_name} monitoring")
         except Exception as e:
-            logger.warning(f"Failed to start {self.asset_name} monitoring: {e}")
+            logger.warning(f"Failed to start {thread_name} monitoring: {e}")
             self._process = None
 
     def finish(self) -> None:
         if self._process is None:
             return None
 
+        thread_name = f"{self.asset_name[:15]}"
         try:
             self._process.join()
-            logger.info(f"Joined {self.asset_name} monitor")
+            logger.info(f"Joined {thread_name} monitor")
             for metric in self.metrics:
                 if isinstance(metric, SetupTeardown):
                     metric.teardown()
         except Exception as e:
-            logger.warning(f"Failed to finish {self.asset_name} monitoring: {e}")
+            logger.warning(f"Failed to finish {thread_name} monitoring: {e}")
         finally:
             self._process = None


Test patch: