UnixNetProcessor::connect_re allocates from another thread's freelist
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 45/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- cpp
- Domínio
- backend, networking
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- C++
- Estrelas
- 2k
- Forks
- 903
- Merge médio
- 4d 4h
- PRs com merge (30d)
- 135
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/trafficserver
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIOTalvez já em andamento @NginxL assumiu hoje. AbertaBug Good First Issue IOBuffer Network
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/trafficserver#14220 ·
Mantenedores costumam responder em até 2 dias
-
MallocAllocator does not check for allocation failureTalvez já em andamento @umrndem assumiu hoje. AbertaBug Core Good First Issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/trafficserver#14218 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
-
Bug Event System Threads
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/trafficserver#14217 ·
Mantenedores costumam responder em até 2 dias
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative periodTalvez já em andamento @rajeetvk assumiu há 1 dia. AbertaBug Event System Good First Issue TS API
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
apache/trafficserver#14214 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
HostDBContinuation::init memsets a polymorphic ActionTalvez já em andamento @ANMOLSCRIPT assumiu hoje. AbertaBug Good First Issue HostDB
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
apache/trafficserver#14204 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
Todas as issues de apache/trafficserver
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 2 dias
-
bug data-types
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
ClickHouse/clickhouse-cpp#645 ·
Mantenedores costumam responder em até 1 dia
-
bug compatibility difficulty:easy prio:normal
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
NatronGitHub/openfx-misc#524 ·
Mantenedores costumam responder em até 1 dia
-
documentation enhancement help wanted P0
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Mantenedores costumam responder em até 1 dia
-
Type: Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
openscad/openscad#7360 · 2 comentários ·
Mantenedores costumam responder em até 1 dia