From nobody Mon Nov 18 16:13:24 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XsXjc6WhKz5dHW7 for ; Mon, 18 Nov 2024 16:13:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XsXjc5Sg6z4t4D for ; Mon, 18 Nov 2024 16:13:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731946404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Lgt4PSOA1IRLJiXSZobUxTGV9P/ixCDQW0S+7Abdwo=; b=iTPbJn/13HFy2yX/haDvhFVLV18yZShjXl2aRiP1LhWTNuyufy3e+B410wJqpx3bLBebn3 n7kZXOuSuH8OmSRdl5dOXpIvXxEh7EHaNaJ9n+iOgEgRZR5+DjcjCjGOaDf/m1Ay2Xpi4n BY4Es/zmIJ8rEZVF7UAMUvbflk4mqROL9NmduwsW7iZI5AHUmSNNsNv291ulz+rl5Ufyg/ W92ecWj61h/D3Mzy2DScDor4CeYVQHXLb6OTmpptaZ0fLn5elmwkuYduAjGBMQ+1cSMmks ZEwKmQaxOMSuNhX1Cgd/GojQDeA8WaAvqsgS0lSPWOm0gmDy9eV85VZtktZHlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731946404; a=rsa-sha256; cv=none; b=DQT2mxTosDXUSttP8GbuCjMtEP/2BvFYGrzuUhl23XR6tCJNq+z4sAEmpgn+6sQkisw7mU X6TV/A7vx3c8dhN4lEVoHIj6pTwz0xG24tF12GS+zDV6mQSciDotsVD7OmA6bJXGYL6Eww 8CoVB1mBRWid6bwampoFDeXcDlPEg8wQQDJKHD/tCtLGSXRW6nmgHLTN1ukLWG2mSRizHR eqJwJhKhU56FUR76V/jopzcpEfD1EyQ1FobCwLtIIFa+Ye1atdJS+WF6wij870z2X/qEB2 g++TiFCtUXKR4cd9uDEG9Teish0EkEUiffhRQ5mAZfhECMl1aKyk+aR2nbylMQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XsXjc4xnJzmQj for ; Mon, 18 Nov 2024 16:13:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4AIGDOor010244 for ; Mon, 18 Nov 2024 16:13:24 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4AIGDO5Y010243 for bugs@FreeBSD.org; Mon, 18 Nov 2024 16:13:24 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 282713] Process enters in STOP state and doesn't respond to any signal. Date: Mon, 18 Nov 2024 16:13:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: rupeshpilania@gmail.com X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282713 --- Comment #9 from Rupesh Pilania --- Running two instances are enough to bring system less responsive. Running 5 instances will cause system Freeze. Compiled using cc -lpthread. #include #include #include #include #define NUM_THREADS 1000 // Number of threads; adjust based on system capability #define NUM_ITERATIONS 100000 // Number of iterations per thread pthread_mutex_t lock; pthread_mutexattr_t attr; void handle_error(int err, const char *msg) { fprintf(stderr, "%s: %s\n", msg, strerror(err)); exit(EXIT_FAILURE); } void *thread_func(void *arg) { int thread_num =3D *((int *)arg); free(arg); // Free allocated memory for thread argument for (int i =3D 0; i < NUM_ITERATIONS; i++) { // Lock and unlock the mutex to simulate contention if (pthread_mutex_lock(&lock) !=3D 0) { perror("Failed to lock mutex"); } // Simulate some work inside the critical section // (we keep it minimal to maximize lock contention) if (pthread_mutex_unlock(&lock) !=3D 0) { perror("Failed to unlock mutex"); } // Small sleep to prevent the system from just cycling too quickly usleep(1); } printf("Thread %d completed.\n", thread_num); return NULL; } int keep_create_threads() { pthread_t threads[NUM_THREADS]; //pthread_mutex_init(&lock, NULL); int err; // Initialize mutex attributes err =3D pthread_mutexattr_init(&attr); if (err !=3D 0) handle_error(err, "pthread_mutexattr_init"); // Set the mutex as robust err =3D pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); if (err !=3D 0) handle_error(err, "pthread_mutexattr_setrobust"); // Initialize the mutex with the robust attribute err =3D pthread_mutex_init(&lock, &attr); if (err !=3D 0) handle_error(err, "pthread_mutex_init"); // Create threads for (int i =3D 0; i < NUM_THREADS; i++) { int *thread_num =3D malloc(sizeof(int)); // Allocate memory for ea= ch thread's number if (!thread_num) { perror("Failed to allocate memory for thread number"); exit(EXIT_FAILURE); } *thread_num =3D i; if (pthread_create(&threads[i], NULL, thread_func, thread_num) !=3D= 0) { perror("Failed to create thread"); exit(EXIT_FAILURE); } } // Wait for all threads to finish for (int i =3D 0; i < NUM_THREADS; i++) { if (pthread_join(threads[i], NULL) !=3D 0) { perror("Failed to join thread"); } } pthread_mutex_destroy(&lock); printf("All threads completed.\n"); return 0; } int main() { while(1){ keep_create_threads(); }=20 return 0; } --=20 You are receiving this mail because: You are the assignee for the bug.=