public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST.
@ 2026-02-09 23:44 Stephen Bertram via ltp
  2026-02-11  8:43 ` Andrea Cervesato via ltp
  2026-02-18 12:32 ` Andrea Cervesato via ltp
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Bertram via ltp @ 2026-02-09 23:44 UTC (permalink / raw)
  To: ltp; +Cc: Stephen Bertram

When run in parallel you can sometimes get the following error:
TBROK: mq_open(/test_mqueue,194,0700,(nil)) failed: EEXIST (17)

This change allows for unique queue names per
process, when executed in parallel with -w #.
---
 testcases/kernel/syscalls/utils/mq.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/syscalls/utils/mq.h b/testcases/kernel/syscalls/utils/mq.h
index da45d2daf..eb66328d5 100644
--- a/testcases/kernel/syscalls/utils/mq.h
+++ b/testcases/kernel/syscalls/utils/mq.h
@@ -12,9 +12,9 @@
 
 #define MAX_MSGSIZE	8192
 #define MSG_LENGTH	10
-#define QUEUE_NAME	"/test_mqueue"
-#define QUEUE_NAME_NONBLOCK	"/test_mqueue_nonblock"
 
+static char queue_name[64];
+static char queue_name_nonblock[64];
 static char smsg[MAX_MSGSIZE];
 static struct sigaction act;
 
@@ -29,8 +29,8 @@ static void cleanup_common(void)
 	if (fd_nonblock > 0)
 		SAFE_CLOSE(fd_nonblock);
 
-	mq_unlink(QUEUE_NAME);
-	mq_unlink(QUEUE_NAME_NONBLOCK);
+	mq_unlink(queue_name);
+	mq_unlink(queue_name_nonblock);
 }
 
 static void sighandler(int sig LTP_ATTRIBUTE_UNUSED) { }
@@ -39,14 +39,17 @@ static void setup_common(void)
 {
 	int i;
 
+	snprintf(queue_name, sizeof(queue_name), "/test_mqueue_%d", getpid());
+	snprintf(queue_name_nonblock, sizeof(queue_name_nonblock), "/test_mqueue_nonblock_%d", getpid());
+
 	act.sa_handler = sighandler;
 	sigaction(SIGINT, &act, NULL);
 
 	cleanup_common();
 
 	fd_root = SAFE_OPEN("/", O_RDONLY);
-	fd = SAFE_MQ_OPEN(QUEUE_NAME, O_CREAT | O_EXCL | O_RDWR, 0700, NULL);
-	fd_nonblock = SAFE_MQ_OPEN(QUEUE_NAME_NONBLOCK, O_CREAT | O_EXCL | O_RDWR |
+	fd = SAFE_MQ_OPEN(queue_name, O_CREAT | O_EXCL | O_RDWR, 0700, NULL);
+	fd_nonblock = SAFE_MQ_OPEN(queue_name_nonblock, O_CREAT | O_EXCL | O_RDWR |
 		O_NONBLOCK, 0700, NULL);
 
 	for (i = 0; i < MAX_MSGSIZE; i++)
-- 
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST.
  2026-02-09 23:44 [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST Stephen Bertram via ltp
@ 2026-02-11  8:43 ` Andrea Cervesato via ltp
  2026-02-11  8:55   ` Petr Vorel
  2026-02-18 12:32 ` Andrea Cervesato via ltp
  1 sibling, 1 reply; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2026-02-11  8:43 UTC (permalink / raw)
  To: Stephen Bertram, ltp

Hi,

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

-- 
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST.
  2026-02-11  8:43 ` Andrea Cervesato via ltp
@ 2026-02-11  8:55   ` Petr Vorel
  2026-02-11 12:03     ` Stephen Bertram via ltp
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2026-02-11  8:55 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: Stephen Bertram, ltp

Hi Stephen,

> Hi,

> Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Out of curiosity I wonder how you achieve the clash. I was not able to, when
running many processes long time enough:

./mq_notify01 -i 200000 &
./mq_notify01 -i 200000 &
...

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST.
  2026-02-11  8:55   ` Petr Vorel
@ 2026-02-11 12:03     ` Stephen Bertram via ltp
  2026-02-18 13:11       ` Petr Vorel
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Bertram via ltp @ 2026-02-11 12:03 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

Running with 4 parallel, so passing `-w 4` to kirk or runltp.

It doesn't happen all the time, but maybe 1 in 4 it will give an EEXIST
error. And so far it's only happened with one of the 4 instances.

It happened for me with mq_timedreceive01.

thanks,

stephen
He/His/Him


On Wed, Feb 11, 2026 at 3:55 AM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Stephen,
>
> > Hi,
>
> > Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Out of curiosity I wonder how you achieve the clash. I was not able to,
> when
> running many processes long time enough:
>
> ./mq_notify01 -i 200000 &
> ./mq_notify01 -i 200000 &
> ...
>
> Kind regards,
> Petr
>
>

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST.
  2026-02-09 23:44 [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST Stephen Bertram via ltp
  2026-02-11  8:43 ` Andrea Cervesato via ltp
@ 2026-02-18 12:32 ` Andrea Cervesato via ltp
  1 sibling, 0 replies; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2026-02-18 12:32 UTC (permalink / raw)
  To: Stephen Bertram, ltp

Merged, Thanks.


-- 
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST.
  2026-02-11 12:03     ` Stephen Bertram via ltp
@ 2026-02-18 13:11       ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2026-02-18 13:11 UTC (permalink / raw)
  To: Stephen Bertram; +Cc: ltp

Hi Stephen,

> Hi Petr,

> Running with 4 parallel, so passing `-w 4` to kirk or runltp.

> It doesn't happen all the time, but maybe 1 in 4 it will give an EEXIST
> error. And so far it's only happened with one of the 4 instances.

> It happened for me with mq_timedreceive01.

Thanks for info.

BTW this was merged without your Signed-off-by: tag (SOB) [1].

Please next time don't forget to add to the commit message:
Stephen Bertram <sbertram@redhat.com>

Thanks!

Kind regards,
Petr

[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-18 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 23:44 [LTP] [PATCH v1] mq_timedreceive01: fails sometimes with EEXIST Stephen Bertram via ltp
2026-02-11  8:43 ` Andrea Cervesato via ltp
2026-02-11  8:55   ` Petr Vorel
2026-02-11 12:03     ` Stephen Bertram via ltp
2026-02-18 13:11       ` Petr Vorel
2026-02-18 12:32 ` Andrea Cervesato via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox