473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Updates not visible to client

Hi, could someone explain the following please?

I have a Java application (app A) which "polls" a MySQL database table
for records with a certain column set to 0. It runs continuously,
utilising the same commection repeatedly.

The other day, I had a support call raised, whereby there were clearly
suitable records in the database, but my application was not selecting
them.

I wrote a standalone test app (app B) to read the same table and list
the records with the column=0. Sure enough, this app listed records as
requested.

So, app A retrieved zero records whilst app B retrieved many. Both
apps *are* using the same select statement.

I think it might be something to do with the rules governing when
updates become visible to clients.

The application that writes records to the database is not mine so I
don't know all the details. It's a php webapp that seems pretty simple
and just does plain inserts into the table with no attempt to do
anything non-default wrt locking afaik.

Any useful comments or clues to help explain this most gratefully
received.

Regards

Martin
Jul 23 '05 #1
7 1633
Martin Woolley wrote:
I think it might be something to do with the rules governing when
updates become visible to clients.


There are no such rules. The error is propably in the app A, which
either fails to do the queries, or fails to show the results to user.
Jul 23 '05 #2
Aggro <sp**********@yahoo.com> wrote in message news:<l1***************@read3.inet.fi>...

There are no such rules. The error is propably in the app A, which
either fails to do the queries, or fails to show the results to user.


There most certainly are such rules. They relate to the way that locks
are applied and associated updates made visible. See
http://dev.mysql.com/doc/mysql/en/an...nsactions.html for some
comment on this.

App A runs 24x7 and has exhibited no issues in this area at all until
this one incident occured. If there's an issue with this application
then it is something subtle. All it does is

1. Get connection
2. Repeat
2.1 select * from table where condition limit n
2.2 sleep 5 seconds
2.3 Repeat this loop forever

And like I said, this one time, App A executing the select in 2.1
retrieved zero records whilst App B executing the same select
retrieved some records.

What I haven't found out yet is what storage model the MySQL database
is using.

Anyway, the issue may have nothing to do with locks either, I just
wanted to explore this with any real experts out there (ie people who
at least are aware of such issues).
Jul 23 '05 #3
Martin Woolley wrote:
There most certainly are such rules. They relate to the way that locks
are applied and associated updates made visible. See
http://dev.mysql.com/doc/mysql/en/an...nsactions.html for some
comment on this.
Yes I know that, but you explained that the PHP app doen't use any of
those. I ment that there are no hidden rules that would cause the
behaviour you explained.
1. Get connection
2. Repeat
2.1 select * from table where condition limit n
2.2 sleep 5 seconds
2.3 Repeat this loop forever


You never reset the connection? What if there is a network failure and
client gets disconnected? Or there might be some mystic connection
buffer that gets full over the time.

Did the application get the new data after it was restarted?
Jul 23 '05 #4
Aggro <sp**********@yahoo.com> wrote in message news:<D3***************@read3.inet.fi>...
Martin Woolley wrote:
There most certainly are such rules. They relate to the way that locks
are applied and associated updates made visible. See
http://dev.mysql.com/doc/mysql/en/an...nsactions.html for some
comment on this.


Yes I know that, but you explained that the PHP app doen't use any of
those. I ment that there are no hidden rules that would cause the
behaviour you explained.
1. Get connection
2. Repeat
2.1 select * from table where condition limit n
2.2 sleep 5 seconds
2.3 Repeat this loop forever


You never reset the connection? What if there is a network failure and
client gets disconnected? Or there might be some mystic connection
buffer that gets full over the time.

Did the application get the new data after it was restarted?

Thanks for clarifying.

If there's network failure then the application takes care of
reconnecting itself. This actually happens quite frequently (at least
once a day) for reasons I won't go into, and the recovery code seems
quite reliable and robust. As it's a java app it's reliant on the
MySQL JDBC driver to report such issues. I did note yesterday that the
driver has an auto-reconnect parameter I could set, but at present I
do not and attempt to handle all such issues in the application.

The application did get the new data after it was restarted. So it
does sound like maybe the old connection was invalidated in some way.
What do you think? I don't understand how it could become
"invalidated" without this resulting in an Exception being thrown by
the JDBC driver.
Jul 23 '05 #5
Martin Woolley wrote:
The application did get the new data after it was restarted. So it
does sound like maybe the old connection was invalidated in some way.
What do you think?


I would first test how the application handles situation where network
cable in unplugged and then reattached after at least one failed query.

If the application doesn't handle that situation I would make a guess
that the problem is there. If it handles that situation I might try to
test other possible scenarios, like database server shutdown -> start
situation.

If the application handles all that then I could only wonder what the
reason was. And then I would try to add some debug data to the
application to find out more of the cause, next time the connection fails.
Jul 23 '05 #6
Aggro <sp**********@yahoo.com> wrote in message news:<7T************@read3.inet.fi>...
Martin Woolley wrote:
The application did get the new data after it was restarted. So it
does sound like maybe the old connection was invalidated in some way.
What do you think?


I would first test how the application handles situation where network
cable in unplugged and then reattached after at least one failed query.

If the application doesn't handle that situation I would make a guess
that the problem is there. If it handles that situation I might try to
test other possible scenarios, like database server shutdown -> start
situation.

If the application handles all that then I could only wonder what the
reason was. And then I would try to add some debug data to the
application to find out more of the cause, next time the connection fails.


Thanks for these suggestions. I've tested these scenarios
previously.... but I wonder if there's some specific combination of
conditions in these situations... which I have not tested. OK, so no
magic solution.... looks like the only way to solve this is to work
hard to try and recreate the issue in my test environment.

Regards

Martin
Jul 23 '05 #7
ma****@woolleynet.com (Martin Woolley) wrote in message news:<e7**************************@posting.google. com>...
Aggro <sp**********@yahoo.com> wrote in message news:<7T************@read3.inet.fi>...
Martin Woolley wrote:
The application did get the new data after it was restarted. So it
does sound like maybe the old connection was invalidated in some way.
What do you think?


I would first test how the application handles situation where network
cable in unplugged and then reattached after at least one failed query.

If the application doesn't handle that situation I would make a guess
that the problem is there. If it handles that situation I might try to
test other possible scenarios, like database server shutdown -> start
situation.

If the application handles all that then I could only wonder what the
reason was. And then I would try to add some debug data to the
application to find out more of the cause, next time the connection fails.


Thanks for these suggestions. I've tested these scenarios
previously.... but I wonder if there's some specific combination of
conditions in these situations... which I have not tested. OK, so no
magic solution.... looks like the only way to solve this is to work
hard to try and recreate the issue in my test environment.

Regards

Martin

I don't quite have proof but.... the incident occurred again, this
time with some extra debug in App A. The debug suggests that the
database read loop is blocking somewhere. My guess therefore (to be
confimed by even more debug now that I know where to put it) is that
it's sitting there waiting for the SQL execution to return... or
something like this. If the issue is that the connection has become
"stale" then I don't understand why I'm not getting a SQLException
from the JDBC driver.
http://dev.mysql.com/doc/connector/j...html#id3029128
describes what's meant to happen.

Any thoughts on why blocking might occur?

Martin
Jul 23 '05 #8

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

Similar topics

1
by: mstjean | last post by:
Beginning to look at the mechanics of deployment at our site for our new project, our first in .NET. Management insists all apps will run from the network, not from desktops and we've managed to...
3
by: Nick L. | last post by:
All, This is a general question regarding how, and if, compiler optimization techniques affect the general concept of being able to update a component of an application without requiring a...
1
by: John | last post by:
I have a panel on a webpage. I use client Javacript to manipulate its visibility using something like: Panel.style.display = 'none'. During a postback, getting the Visible attribute always...
0
by: aeshtry | last post by:
Hello dear friends I have an urgent question. Would you please give me your professional idea? I have an html table containing the ASP.Net validation summary and an ASP.Net label control. The...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
4
by: T.H.N. | last post by:
I'm trying to work out a database design to make it quicker for my client program to read and display updates to the data set. Currently it reads in the entire data set again after each change,...
3
by: Bryan | last post by:
I think it's okay to ask this question in this group, but if not please point me to the correct one! How does one go about doing asynchronous updates between two web clients? Take Google Chat...
1
by: Gimzo | last post by:
Hi, I'm trying to create a button that opens a new window for setting up a whole crapload of constants for an analysis program. For this, I have a JButton. The actionPerformed-method activates...
4
dbrewerton
by: dbrewerton | last post by:
Ok, I'm using code-behind with a MySQL DB to update two tables. It updates the addressbook table fine but the device table won't update. I know its probably some stupid syntax error but I am not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.