473,465 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Reclaiming locks

CJ
Hello Friends -

I've run across the following situation. I have two threads, say T1 and
T2 which access shared data - each locks a mutex before doing so.

Now I have a hard-to-find bug which means that periodically T1 gets
killed unexpectedly. But if it holds the mutex at that point, T2 blocks
for ever!

How can I get T1 to release any locks it's holding when it gets killed?

Oct 29 '07 #1
6 1308
CJ <di*********@invalid.invalidwrites:
Hello Friends -

I've run across the following situation. I have two threads, say T1 and
T2 which access shared data - each locks a mutex before doing so.

Now I have a hard-to-find bug which means that periodically T1 gets
killed unexpectedly. But if it holds the mutex at that point, T2 blocks
for ever!

How can I get T1 to release any locks it's holding when it gets killed?
Find and fix the bug that gets it killed. Anything else will only
cause you more trouble later on.

Follow-ups set to comp.unix.programmer as this is not directly related
to the C language.

--
Måns Rullgård
ma**@mansr.com
Oct 29 '07 #2
CJ <di*********@invalid.invalidwrites:
I've run across the following situation. I have two threads, say T1 and
T2 which access shared data - each locks a mutex before doing so.

Now I have a hard-to-find bug which means that periodically T1 gets
killed unexpectedly. But if it holds the mutex at that point, T2 blocks
for ever!

How can I get T1 to release any locks it's holding when it gets killed?
Standard C has no threads, so comp.lang.c isn't the place to ask about this.

I've redirected followups to just comp.unix.programmer (not that it
will do any good), but comp.programming.threads might also be a good
place to ask.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 29 '07 #3
CJ
On 29 Oct 2007 at 21:05, Måns Rullgård wrote:
CJ <di*********@invalid.invalidwrites:
>Hello Friends -

I've run across the following situation. I have two threads, say T1 and
T2 which access shared data - each locks a mutex before doing so.

Now I have a hard-to-find bug which means that periodically T1 gets
killed unexpectedly. But if it holds the mutex at that point, T2 blocks
for ever!

How can I get T1 to release any locks it's holding when it gets killed?

Find and fix the bug that gets it killed. Anything else will only
cause you more trouble later on.
I promise you, not fixing the bug is not the result of lack of will! It
basically comes down to some completely unmanageable and unpenetrable
code that we have to work with. We can basically work around the bug,
but the only problem is the dead thread keeping its locks - there must
be a solution to that?

Oct 29 '07 #4
On Oct 29, 4:24 pm, CJ <diespamm...@invalid.invalidwrote:
I promise you, not fixing the bug is not the result of lack of will! It
basically comes down to some completely unmanageable and unpenetrable
code that we have to work with. We can basically work around the bug,
but the only problem is the dead thread keeping its locks - there must
be a solution to that?
Run the broken code in its own process. Threads are not isolated from
each other. There is no such thing as a "dead thread", only a crashed
process.

DS

Oct 30 '07 #5
CJ wrote:
Måns Rullgård wrote:
>CJ <di*********@invalid.invalidwrites:
>>I've run across the following situation. I have two threads,
say T1 and T2 which access shared data - each locks a mutex
before doing so.

Now I have a hard-to-find bug which means that periodically T1
gets killed unexpectedly. But if it holds the mutex at that
point, T2 blocks for ever!

How can I get T1 to release any locks it's holding when it
gets killed?

Find and fix the bug that gets it killed. Anything else will
only cause you more trouble later on.

I promise you, not fixing the bug is not the result of lack of
will! It basically comes down to some completely unmanageable
and unpenetrable code that we have to work with. We can basically
work around the bug, but the only problem is the dead thread
keeping its locks - there must be a solution to that?
I thought you had already been told this is off-topic on c.l.c,
because standard C has no threads. You need a newsgroup that deals
with your system, such as comp.unix.programmer.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Oct 30 '07 #6
On Oct 29, 4:24 pm, CJ <diespamm...@invalid.invalidwrote:
I promise you, not fixing the bug is not the result of lack of will! It
basically comes down to some completely unmanageable and unpenetrable
code that we have to work with. We can basically work around the bug,
but the only problem is the dead thread keeping its locks - there must
be a solution to that?
Run the broken code in its own process. Threads are not isolated from
each other. There is no such thing as a "dead thread", only a crashed
process.

DS

Oct 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aswinee | last post by:
I am running Microsoft SQL Server 2000 - 8.00.760 Enterprise Edition on Windows 2003 Enterprise Edition (NT 5.2 Build 3790:) I have 4CPU and 8GB of RAM. I have AWE enabled, /pae /3gb switch is on...
17
by: Dr NoName | last post by:
Help! I have a table that multiple processes must be able to write to concurrently. However, it for some reason gets locked in exclusive mode. I narrowed it down to one SQL statement + some...
6
by: John Carroll | last post by:
Is there a SQL query that can be run against a database that will give me all the details on any locks that are in place at the given time? I am interested in find the lock type and owner. Thank...
0
by: Bruce Pullen | last post by:
DB2 v7.2 (FP7 - DB2 v7.1.0.68) on AIX 5.2.0.0. We're seeing unexpected single row (then commit) insert locking behaviour. We're seeing Applications that already hold row-level W locks in...
4
by: Alex Callea | last post by:
Hi there, We have a web application handling thousands of requests per seconds reading sql server data which is heavily updated. We are generally experiencing no performance problems. On some...
22
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
0
by: pigeonrandle | last post by:
Hello! Does anyone have any thoughts on the best way to go about reclaiming dormant connections? I see people using timers in examples, but their implementations vary from using a separate class...
1
by: shenanwei | last post by:
I have db2 v8.2.5 on AIX V5.3 with all the switches on Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort ...
7
by: praveen | last post by:
Hi When does DB2 go for an IS (Intent Share) lock? IS mode is defined as a mode in which "The lock owner can read data in the locked table, but cannot update this data. Other applications can...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.