UnixNetProcessor::connect_re allocates from another thread's freelist
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- cpp
- Ambito
- backend, networking
Direzione di ricerca
Start with the cited allocation and affinity paths in src/iocore/net/UnixNetProcessor.cc, then read the ownership rule in include/iocore/eventsystem/Thread.h and the cache operations in include/iocore/eventsystem/ProxyAllocator.h. Trace how THREAD_ALLOC_INIT behaves when the selected thread differs from the calling thread, including the TSNetConnect example in src/api/InkAPI.cc. Done means preventing access to another thread’s ProxyAllocator cache and handling the reported missing mutex check safely.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
UnixNetProcessor::connect_re chooses the thread the new connection will run on with eventProcessor.assign_affinity_by_type(cont, opt.etype) (UnixNetProcessor.cc#L192-L193). It then allocates the NetVC from that thread's per-thread freelist, THREAD_ALLOC_INIT(netVCAllocator, t) (UnixNetProcessor.cc#L316).
assign_affinity_by_type returns the calling thread only if it already has the requested event type. Otherwise it returns the continuation's affinity thread or a newly assigned thread of that type (UnixEventProcessor.cc#L662-L677). The allocators have two layers, and only one of them is safe to share between threads. The global ClassAllocator freelists are lock-free and safe to use from any thread (ink_queue.cc#L206). In front of each global allocator, every Thread keeps a ProxyAllocator cache. That cache is a plain singly linked list, popped by thread_alloc and pushed by THREAD_FREE with no atomics or lock (ProxyAllocator.h#L54-L60, #L106-L119). It avoids the CAS on the hot path, and that is only safe because a single thread owns it. Thread.h states the rule: the Thread passed to the macros MUST be the calling OS thread's own Thread (Thread.h#L175-L177). THREAD_ALLOC_INIT only reaches the lock-free global list when that cache is empty. So a connect started from a thread that isn't ET_NET pops another thread's ProxyAllocator cache while that thread may be pushing to or popping from it. One example is a plugin calling TSNetConnect from an ET_TASK continuation (InkAPI.cc#L6774). This is a data race that can corrupt that cache, for example handing the same NetVC out twice.
assign_affinity_by_type also dereferences cont->mutex->thread_holding without a check (L664). It crashes if the caller doesn't hold the continuation's mutex.
A fix is to allocate from the current thread, or from the global allocator, when t != this_ethread().
generated with Claude Opus 5.5 by Josiah VanderZee
- Lingua principale
- C++
- Stelle
- 2k
- Fork
- 903
- Merge medio
- 4g 4h
- PR unite (30g)
- 135
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi 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.
Altre issue di apache/trafficserver
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIOForse già presa @NginxL l’ha presa oggi. ApertaBug Good First Issue IOBuffer Network
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/trafficserver#14220 ·
I maintainer di solito rispondono entro 2 giorni
-
MallocAllocator does not check for allocation failureForse già presa @umrndem l’ha presa oggi. ApertaBug Core Good First Issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/trafficserver#14218 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Bug Event System Threads
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/trafficserver#14217 ·
I maintainer di solito rispondono entro 2 giorni
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative periodForse già presa @rajeetvk l’ha presa 1 giorno fa. ApertaBug Event System Good First Issue TS API
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/trafficserver#14214 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
HostDBContinuation::init memsets a polymorphic ActionForse già presa @ANMOLSCRIPT l’ha presa oggi. ApertaBug Good First Issue HostDB
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/trafficserver#14204 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di apache/trafficserver
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 2 giorni
-
bug data-types
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ClickHouse/clickhouse-cpp#645 ·
I maintainer di solito rispondono entro 1 giorno
-
bug compatibility difficulty:easy prio:normal
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
NatronGitHub/openfx-misc#524 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation enhancement help wanted P0
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openscad/openscad#7360 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno