boostorg / boostorg/interprocess

blocked in message_queue::timed_receive

Abierto
#274 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
185
Forks
131
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I'm using boost_1_89_0 & boost::interprocess::message_queue for inter-process communication. The receiver calls timed_receive to receive messages with a timeout set to 100 milliseconds. It works correctly most of the time, but occasionally it gets blocked, meaning timed_receive does not return.

```
boost::interprocess::message_queue *msg_queue;
// ...
boost::posix_time::ptime timeout = boost::posix_time::microsec_clock::universal_time() + boost::posix_time::milliseconds(100);
bool ret = msg_queue->timed_receive(buf, 8192, recvd_size, priority, timeout);
```

I checked the call stack, and it is blocked at the following location:

boost\interprocess\sync\detail\common_algorithms.hpp

```
template
void try_based_lock(MutexType &m)
{boost::interprocess::message_queue
if(!m.try_lock()){
spin_wait swait;
do{
if(m.try_lock()){
break;
}
else{
swait.yield();
}
}
while(1);
}
}
```

I stepped through the code and found that `m.try_lock()` keeps returning false.

Thanks.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza reproduciendo la llamada reportada a message_queue::timed_receive con el tiempo de espera de 100 milisegundos y, después, inspecciona boost/interprocess/sync/detail/common_algorithms.hpp, donde try_based_lock gira mientras m.try_lock() devuelve false. Rastrea la propiedad del lock y la ruta del tiempo de espera; se considera terminado cuando la llamada reportada retorna en lugar de seguir bloqueada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
operating-systems
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.