DFS file loading fails with Python 3.14 on Windows (error 2003) during test suite execution
- Langage dominant
- Python
- Étoiles
- 5
- Forks
- 1
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
## Summary
mikecore fails to load DFS files with error 2003 (F_ERR_OPEN) when running test suites with Python 3.14 on Windows. Individual tests pass, but full suite execution experiences intermittent failures. Does not occur on Linux or with Python 3.13 on Windows.
## Reproduction
Discovered in modelskill test suite:
```bash
# Fails: Full suite on Windows + Python 3.14
pytest tests/ -v
# Exception: Could not load file ... (Error code 2003)
# Passes: Same test individually
pytest tests/test_pointcompare.py::test_score -v
```
## Test Results
| Platform | Python | Result |
|----------|--------|--------|
| Windows | 3.13 | ✅ Pass |
| Windows | 3.14 | ❌ Intermittent failures |
| Linux | 3.14 | ✅ Pass |
## Root Cause
Python 3.14 introduced ctypes thread safety changes for free-threaded builds. mikecore's singleton DLL loading pattern in `DfsDLL.py` (lines 42-61) lacks thread safety:
```python
class DfsDLL:
Wrapper = None # Global static, no locking
@staticmethod
def Init(libfilepath=None):
if DfsDLL.Wrapper is None: # Race condition
DfsDLL.Wrapper = ctypes.CDLL(...)
```
## Suggested Fix
Add thread-safe initialization with proper locking around singleton check and DLL loading.
## Workaround
Use Python 3.13 on Windows. See modelskill [commit ff699be8](https://github.com/DHI/modelskill/commit/ff699be818efae566e40159a7ef80264e6eec84b).
## Environment
- mikecore: 0.2.2
- Python: 3.14.2
- OS: Windows 11
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par les lignes 42-61 de DfsDLL.py et examinez le chemin de chargement de la DLL singleton ainsi que son comportement d’initialisation lors de l’exécution concurrente des tests. Exécutez pytest tests/ -v sous Windows avec Python 3.14, comparez-le à tests/test_pointcompare.py::test_score, et considérez le travail terminé lorsque la suite complète ne signale plus error 2003 de manière intermittente.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- operating-systems
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 25/100