473,594 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

deadlock detected when inserting data

I am running OSDL-dbt1 - an e-commerce workload
(http://www.osdl.org/lab_activities/k...te/osdl_dbt-1/)
against PostgreSQL: 7.3.3. During the test, I saw a lot of messages in
the database log file:

NOTICE: _sc_id=0, _add_flag=0, _itemcount=0, _i_id=597, _pp_i_id=159,
c_id=32760
ERROR: deadlock detected
WARNING: Error occurred while executing PL/pgSQL function shopping_cart
WARNING: line 311 at SQL statement
WARNING: ROLLBACK: no transaction in progress

The shopping_cart transaction does update/insert to shopping_cart and
shopping_cart_l ine tables, and if it is a new shopping_cart, it queries
the SEQUENCE scid to get a new shopping_cart.

I tried to search the mailing list, and got the impression that if there
are foreign key related to the tables, then deadlock happens. But that
is not my case. I do not have foreign key either referring to this two
tables, or defined on those tables.

Can anyone give some suggestions how I should analyze this problem? Or
are there any documentation? I am not driving the database very hard.
The only comparison I have are the previous runs I did against SAPDB,
which performs better.

Let me know if you need more info.

TIA,

Jenny
--
Jenny Zhang
Open Source Development Lab
12725 SW Millikan Way, Suite 400
Beaverton, OR 97005
(503)626-2455 ext 31

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #1
2 8266
Thanks for your quick response.

I did take some database statistics during the run. I posted at:
http://developer.osdl.org/jenny/deadlock/db_stat/

In the db_activity?.ou t, all the database connections were working on
shopping_cart procedure. Also, I noticed that tran_lock?.out shows that
the same transaction(sho pping_cart) requires multiple locks and not all
of them are granted. Since shopping_cart is a storedprocedure (or
function) written in plpgsql, and it calls other functions, is it
possible that the transaction is too long and holds the locks?

Another question is, I've read that "Each PL/pgSQL function is
automatically treated as a single transaction
by Postgres" at http://www.geocrawler.com/archives/3...2/6/0/9050299/
is it still true? Even though the shopping_cart function calls A and A
has BEGIN and COMMIT in it, pgsql won't commit till all the shopping_cart is done?

Thanks,
Jenny
On Mon, 2003-12-15 at 12:51, Ian Harding wrote:
Deadlocks are hard to figure out sometimes. They don't necessarily have
to do with foreign key constraints. They happen when two transactions
are waiting for each other to finish what they are doing before they
proceed. Instead of waiting forever, a deadlock is declared, and one or
the other is rolled back.

It seems odd that a test suite would have this problem. It looks like
they give informative error messages though, that should be helpful.
Also, you can turn on query logging and look at pg_stat_activit y to see
what's up.

Jenny Zhang wrote:
I am running OSDL-dbt1 - an e-commerce workload
(http://www.osdl.org/lab_activities/k...te/osdl_dbt-1/)
against PostgreSQL: 7.3.3. During the test, I saw a lot of messages in
the database log file:

NOTICE: _sc_id=0, _add_flag=0, _itemcount=0, _i_id=597, _pp_i_id=159,
c_id=32760
ERROR: deadlock detected
WARNING: Error occurred while executing PL/pgSQL function shopping_cart
WARNING: line 311 at SQL statement
WARNING: ROLLBACK: no transaction in progress

The shopping_cart transaction does update/insert to shopping_cart and
shopping_cart_ line tables, and if it is a new shopping_cart, it queries
the SEQUENCE scid to get a new shopping_cart.

I tried to search the mailing list, and got the impression that if there
are foreign key related to the tables, then deadlock happens. But that
is not my case. I do not have foreign key either referring to this two
tables, or defined on those tables.

Can anyone give some suggestions how I should analyze this problem? Or
are there any documentation? I am not driving the database very hard.
The only comparison I have are the previous runs I did against SAPDB,
which performs better.

Let me know if you need more info.

TIA,

Jenny
------------------------------------------------------------------------

SPAM: BAYES_00 (-5.2 points) Bayesian classifier says spam probability is 0 to 1%
Score Total: -5.2

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 12 '05 #2
On Mon, 2003-12-15 at 22:43, Jenny Zhang wrote:
Another question is, I've read that "Each PL/pgSQL function is
automatically treated as a single transaction
by Postgres" at http://www.geocrawler.com/archives/3...2/6/0/9050299/
is it still true? Even though the shopping_cart function calls A and A
has BEGIN and COMMIT in it, pgsql won't commit till all the shopping_cart is done?


It is true. If no transaction is already in progress, each statement is
a transaction in itself (or begins a transaction if autocommit is off).
Therefore any function must necessarily execute inside a transaction.

You cannot use BEGIN in a PL/pgSQL function to begin a transaction,
since a transaction is already in progress. In PL/pgSQL, BEGIN marks
the start of the executed code (and follows any declarations).

--
Oliver Elphick Ol************@ lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
=============== =============== ==========
"The fear of the LORD is the instruction of wisdom, and
before honour is humility." Proverbs 15:33

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #3

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

Similar topics

1
3032
by: New MSSQL DBA | last post by:
I have recently been assigned to take over several MSSQL environments and found some of the existing practice confusing. As most of my previous experiences are on Oracle and Unix platform so would like your inputs and comments. 1) TX log truncate: In the existing environment, there are scheduled jobs to truncate transaction log of each database in the server and shrink them back to a desired size, say 1G. These jobs are all scheduled...
1
3661
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into "access_log", the referential integrity triggers generate these queries: SELECT 1 FROM ONLY "public"."application_type" x
2
8959
by: Sumanth | last post by:
Hi , I am trying to acquire a lock on a table A in exclusive mode, and this statement gives an error indicating a deadlock or timeout has been detected. The lock timeout value is set to 0 which I understand is to wait for however long it takes to acquire a lock. Also there are other processes that have acquired row level exclusive locks on the table A when this error happened.Is DB2 throwing this error as a pre-emptive measure.
1
5641
by: Zubair.NET! | last post by:
In our web application we are calling different XML Webservices and make approximately 25 calls every 10 minutes. We use a separate thread to call a the webservice (Crawler) and populate our cache -- our application then retrieves the data from the Cache -- the cache is set to expire in approximately 25 minutes -- but since the Crawler populates the cache every 10 minutes with the new data -- thus it never expires. In above scenario --...
0
2296
by: Hemant Shah | last post by:
Folks, I have been getting SQLCODE -911 while reading data from a table. When I look at the db2diag.log file I see following: 2006-10-10-14.33.13.384726-240 I127058C470 LEVEL: Warning PID : 233904 TID : 1 PROC : db2agent (CFG) 0 INSTANCE: db2prod NODE : 000 DB : CFG APPHDL : 0-1415 APPID: *LOCAL.db2prod.061010183323 FUNCTION: DB2 UDB, access plan manager,...
3
17358
by: kavin | last post by:
hi, can any one help me in detecting a deadlock and to clear the deadlock when it occours? how to monitor the databases for deadlocks?
4
7548
by: raccoon | last post by:
keep getting an ora-04020: deadlock detected while trying to lock object XDB. XDNDBKDJjilnd The statement I'm trying to issue is: REVOKE execute on abc."descript_T" FROM PUBLIC; I am not able to find a solution for this besides the fact of just try the operation again at a later time. I did try it again and again throughout the day, but get the same error every single time.
1
7673
by: Olav | last post by:
Does anyone know what this means? Olav ISAPI 'c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
0
1945
by: halex | last post by:
Hello, I am having deadlock problem when I have a lot of visitors on my website at the same time. I am using NetTiers templates to generate C# classes for accessing DB layer and problem is in my custom Store Procedure. I have Article table and ArticleLanguage table. One record from Article (Id, Position, StatusId) table is the same for all languages and in ArticleLanguage (Id, LanguageId, ArticleId, Name) table I have only article names...
0
7946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8251
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8003
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8234
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6654
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3897
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2385
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 we have to send another system
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.