Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8297201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:19:17+00:00 2026-06-08T15:19:17+00:00

I’ve been grappling with what appears to be a bug between Django/MySQL, but is

  • 0

I’ve been grappling with what appears to be a bug between Django/MySQL, but is perhaps just my own misunderstanding in the nuances of threaded applications, etc.

First, a bit of information on my application. I have a multithreaded application programmed in python that is using Django’s models. There are three different types of threads that supply information down a pipeline through the use of Queues. Thread one pulls a bunch of objects from the database and throws them into a queue. The next thread (the main workhorse) takes the item off the queue and pulls an HTTP request and throws that onto a queue for the third thread. The third thread does some processing on the html and updates some database values.

Here’s the weird part. I have a mysql column called “level.” The first thread pulls rows where level = 0. After parsing the HTTP response the final thread is supposed to update the row in the database with level = 1 along with all manner of data that is parsed out of the HTTP. Well at full speed the script says it’s processing about 1,000 a minute. But the number of rows with level = 1 increases at about 1/3 of that. Here’s some excerpt from the problem when going slowly.

a picture of program output showing correct output

The important part is the lines that say “Updating level one entry.” The numbers at the end are displaying the number of level 1 rows in the database, followed by the current “level” status of the working data object. This output is when it is functioning correctly. It is produced by this code block:

# update our current record to reflect having run here
current.update = datetime.now()
# this prints out the "updating level one" text with debugging information
self.send_message(304, str(Scrape.objects.filter(level=1).count()) + ":" + str(current.level))
current.level = 1
current.save()
# and after saving the information to the db, prints it out again
self.send_message(304, str(Scrape.objects.filter(level=1).count()) + ":" + str(current.level))
self.send_message(308, str(current.asin)) # send out a consuming message

However, after running for a little while I will get output that is basically identical, except the count for number of objects at level = 1 will not increase. This makes absolutely no sense to me. If the value was = 0 before, and is = 1 now, then it should increase the number of level = 1 entries!

I don’t believe this is merely caching but more likely either an error that I’ve made or some sort of unexpected behavior out of the components I’m using. Any advice from more experienced eyes would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:19:24+00:00Added an answer on June 8, 2026 at 3:19 pm

    My immediate guess would be a transaction issue. Since these are running in separate threads, they’ll have their own transactions, and therefore will be subject to transaction isolation. Even if the thread doing the updating commits its transaction and starts a new one, the thread outputting the count will not necessarily see that update until it too starts a new transaction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.