Segmentation error when calling .fit()

### Describe the bug

Hey all,

I'm currently busy working on a solution for a classification problem using LogisticRegression from sklearn.linear_model. I'm training multiple classifiers at the same time with the same hyperparameters and only slightly different input. The largest difference is coming from the number of unique labels.

I don't have any issues fitting data on a model with size 1.500.000 x 20000 with ~200 unique labels. I do however run into issues when my training data has size 1.000.000 X 11000 with ~2500 labels. I'm executing these on docker containers but after calling .fit my containers exit and get an exit code of 139 indicating a segmentation error. I'm using the saga solver. As far as I know this is not a python error but underlying cython problem and my hunch is that because of my dimensions I'm getting a stack overflow somewhere. I've already checked out the source code but did not find any conclusive answers.

My question is: does anyone have an idea where this actually goes wrong and if there is a workaround?

I'm running scikit-learn==1.0.2 with Python 3.7.11

### Steps/Code to Reproduce

```python3
import numpy as np
from sklearn.linear_model import LogisticRegression

nrows = 1000000
num_features = 11000
unique_labels = 2500

features = np.random.rand(nrows, num_features) 
target = np.random.randint(low=0,high=unique_labels, size=nrows)

clf = LogisticRegression(C=1, solver='saga', max_iter=1, verbose=1)
clf.fit(features,target)
```

### Expected Results

No error is thrown.

### Actual Results

Nothing in the traceback. My container exits with status code 139. When running this on Jupyter my kernel exits.

### Versions

```shell
System:
    python: 3.7.11 (default, Jul 22 2021, 16:14:15)  [GCC 6.3.0 20170516]
executable: /usr/local/bin/python
   machine: Linux-5.10.104-linuxkit-x86_64-with-debian-9.13

Python dependencies:
          pip: 19.3.1
   setuptools: 57.4.0
      sklearn: 1.0.2
        numpy: 1.21.6
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
This will be difficult to reproduce because the data are pretty large.
For instance, I would get in failure:

```python
In [1]: import numpy as np
   ...: from sklearn.linear_model import LogisticRegression
   ...: 
   ...: nrows = 1000000
   ...: num_features = 11000
   ...: unique_labels = 2500
   ...: 
   ...: features = np.random.rand(nrows, num_features)
   ...: target = np.random.randint(low=0,high=unique_labels, size=nrows)
   ...: 
   ...: clf = LogisticRegression(C=1, solver='saga', max_iter=1, verbose=1)
   ...: clf.fit(features,target)

---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
Cell In [1], line 8
      5 num_features = 11000
      6 unique_labels = 2500
----> 8 features = np.random.rand(nrows, num_features) 
      9 target = np.random.randint(low=0,high=unique_labels, size=nrows)
     11 clf = LogisticRegression(C=1, solver='saga', max_iter=1, verbose=1)

File mtrand.pyx:1202, in numpy.random.mtrand.RandomState.rand()

File mtrand.pyx:436, in numpy.random.mtrand.RandomState.random_sample()

File _common.pyx:307, in numpy.random._common.double_fill()

MemoryError: Unable to allocate 82.0 GiB for an array with shape (1000000, 11000) and data type float64
```

Are you sure that you don't get a memory issue that could be translated to a segmentation fault depending on your setting (i.e. jupyter + container)?

Labels: Bug, Needs Triage