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

  • SEARCH
  • Home
  • 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 8688715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:26:47+00:00 2026-06-12T23:26:47+00:00

Scenario: web based text game Player A sends request to send 10,000 credits to

  • 0

Scenario: web based text game

  1. Player A sends request to send 10,000 credits to player B (this request takes 20ms to complete).
  2. 3ms after sending first request (which is still being processed) player A sends another request to battle player C, this request takes 100ms to complete.

What’s happening, in step 1 an app removes credits from player A, gives them to player B, but before this is persisted in the db, second request comes, loads state still showing 10k in an account of player A and overwrites correct state from request 1 (0 credits) with 10k + battle loot from step 2. Result: player A and B both have now 10k in their accounts, the money just doubled.

What can be done to protect against this? This is hypothetical scenario to show the problem, for above scenario account=account+loot sql would do, but I’m looking for solution that works with all data types.

  • 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-12T23:26:48+00:00Added an answer on June 12, 2026 at 11:26 pm

    If you set the transaction isolation level on your database to serializable, you can treat the above as a single atomic occurrence at the database level.

    Atomicity is one of the key components of a database system.

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

Sidebar

Related Questions

Scenario: I build a simple web based app for mobile that needs to interact
Let me share the following scenario: I have a ASP.NET intranet Web-based application that
Scenario The web server gets a request for http://domain.com/folder/page . The Accept-Language header tells
This is the scenario: -Hosted web application. -Application trust level is full trust, because
Here's the scenario, I am working on a web-based application develped used JSP/Servlet technique,
Scenario: Apache Wicket based web application running on Tomcat server. User opens URL in
i need to implement this scenario Brief about that is have two java based
I am developing a php-based web application in which there is a text area
Ok, this is an very common scenario in web dev, with a very common
Here is the scenario: I am getting data from database through web server. Based

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.