Permission denied using mmap on Windows
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
I have a Windows service that creates a memory mapped file using the global scope and a client that reads the global scope. The problem is that the current implementation calls CreateFileMapping() instead of OpenFileMapping(). So when the client tries to connect the global scope, its throws a permission error.
The expected behavior is: Only the server has the permission the create a global memory mapped file and any client can read the created memory mapped file.
Here is a sample code:
server.py
from mmap import mmap
from pickle import load, dump
mm = mmap(-1, 32, tagname=r'Global\test')
last_request_id = None
while True:
mm.seek(0)
try:
request_id = int(load(mm))
if request_id != last_request_id:
last_request_id = request_id
print(request_id)
except Exception:
pass
client.py
from mmap import mmap
from pickle import dump
with mmap(-1, 32, tagname='Global\test') as mm:
request_id = 1
dump(request_id, mm)
Your environment
- CPython versions tested on: 3.11
- Operating system and architecture: Windows 11 - Version 22H2 (OS Build 22621.819)
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in Modules/mmapmodule.c intorno alla riga 1531 e leggi la gestione di mmap su Windows insieme alla documentazione di CreateFileMapping() e OpenFileMapping(). Riproduci l’esempio server.py e client.py su Windows 11. Il lavoro è completato quando il server può creare il mapping Global e il client può aprirlo e leggerlo senza un errore di autorizzazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100