• (nodebb)

    Well, the last two times I traveled by train, coaches were not available since they just went part of the train, so my reservations basically disappeared into thin air. No delays, no cancellation - just a train with missing coaches. But I have to say a concurrency issue is similar frustrating, didn't happen to me (yet).

  • NotABigDeal (unregistered)

    Another option is that when a race condition double-booking happens, it is no big deal. Just something that is quickly and easily worked out on the train as happened in the article. Both passengers were happy they got to they were going with an amusing story to tell, so they never reported a bug.

  • Tinkle (unregistered)

    TRWTF is not applying for a refund (which would force them to fix the booking system,) or the train company not charging to reserve a seat (unlikely.)

  • Scragar (unregistered)

    This is why DB consrraints are important even if you have logic in code.

    If the DB didn't allow two people on the same train to have the same seat then one transaction would fail. That's annoying when you're the person who has to reselect their seat or retry, but it's better than knowingly allowing bad data to exist.

  • klinsten1 (github)

    Clearly this did not happen in Belgium... the real WTF would be taking the train and expecting everything to go smoothly and without delay

  • Brian (unregistered)

    I can imagine the PR comments, because I've made similar ones before: "Hey, isn't there a race condition here? What happens if two people try to book the same seat at the same time?" "Come on, that would never happen, and it would be way to much work to refactor this. Just approve the PR already."

    improbable != impossible

  • (nodebb)

    That's not actually a technical problem, it's more a procedural problem.

    Because the reservation happens during the booking process, but the actual confirmation is done only after payment is confirmed.

    So for the time being, does the company want to literally reserve the seat, so that no one else can reserve it in the meantime? And this is not necessarily for just two minutes, it often happens that people are starting a booking process and then deciding differently. Since you don't know, you have to wait a reasonable time before canceling the booking. If the seats are staying blocked for other customers during that time, those other customers will be frustrated when they only can see very few available seats, but when they're boarding half of the others are available suddenly.

    Another solution would be to raise an error to the customer after payment if the same reserved seat was taken by someone else between booking and payment. But then the customer would need to select some other seat after the payments was already done. This would complicate the whole process a lot, and would potentially confuse those who are already overwhelmed by the normal process.

    So it's a common problem. As a provider, you're having three options:

    1. The pessimistic approach: Making it fail safe, but risking that customers have less options then necessary.

    2. The optimistic approach: Let them book what is available, and in case of a conflict, let them chose again. Safe but complex.

    3. The super optimistic approach, what was done here: Let them book what is available, and in case of a conflict, let the customers agree on each other.

    So it's not a WTF, it's just one of three options.

  • (nodebb)

    Coincidentally, Computerphile just published a YouTube video about race conditions today.

    Not sure if I'm allowed to include a link, so instead just add this after the "?v=" in a standard YouTube watching URL: W0jPTqIo5oE

  • (nodebb)

    AFAIK no major online sales website ever sells the identical object to 2 people, so someone has solved the "how long to lock the item" problem satisfactorily. Just not this railroad

  • COBOL Dilettante (unregistered) in reply to Melissa U
    Because the reservation happens during the booking process, but the actual confirmation is done only after payment is confirmed.

    In the UK, IME, "reserving" a seat doesn't actually let you pick a specific seat; the booking system chooses for you once the payment is confirmed. You can express vague preferences e.g. for a table, and if you buy multiple tickets together the system will try to choose seats that are close together, but ultimately you aren't "reserving" much more than an aspiration that you might not have to stand this time round

  • (nodebb) in reply to Scragar

    I'm not German, and it still took me a moment to figure out that Scragar was not referring to Deutsche Bahn.

  • Acronym (unregistered) in reply to Melissa U

    The best solution varies by demand. I believe most train trips are not high demand with people rushing to grab the best seats ASAP... On another domain, like concerts, this does happen, and the solution is the pessimistic approach with a big obvious countdown, shown to the user, that their reservation will expire if they don't complete the purchase in about 10 minutes.

  • Fizzlecist (unregistered) in reply to NotABigDeal

    Or there are so many new features & improvements being added there's no time to get to trivial things like fixing existing bugs

  • (nodebb) in reply to Melissa U

    So for the time being, does the company want to literally reserve the seat, so that no one else can reserve it in the meantime?

    In many booking systems, the answer to this is yes. If I book a specific seat at a cinema or theatre or a room in a hotel, the system will often inform me that my reservation will be held for x minutes where x is something like 10 or 15 and it will be released if I haven't paid by then. This is the only way to work a booking system, if you think about it because everybody booking something wants to know that the something is available before they enter their payment details. It causes much less frustration to tell somebody that the train is full when it might not be completely full in a minute or two than to tell them they can book a seat and, right at the end (after they've given you their credit card number) tell them "actually no".

  • mihi (unregistered) in reply to Melissa U

    That reminds me of people churning group bookings with Ryanair... (not legally forbidden but very frowned upon and they reserve the right to ban you if you catch you doing this repeatedly).

    For those who do not know, if you don't pay the fee for a pre-selected seat, Ryanair assigns a specific seat to you during your online check-in. You then get the option to pay a fee to choose a different one.The logic is that it will assign middle seats to you as long as they are still available, so if you don't want a middle seat, nor to try risking a late check-in (where fewer middle seats are available), nor pay the fee some people resort to this:

    • Figure out how many middle seats are on the plane type that is used.
    • Just before starting your check-in, in a second browser (unrelated to your check-in process) start booking a group booking with that many passengers on that plane (or fewer in case it is booked out too much), choose to pay an extra to pick seats, and pick all the remaining middle seats.
    • Then remain on the confirmation screen just before proceeding to payment, and do the check-in in your normal browser.
    • Once you got your seat, switch back to the other browser and cancel/abort the pending group reservation.
  • mihi (unregistered)

    (that last comment was trying to do an itemized unordered list, but the bullet points apparently got lost. Hopefully it is legibly enough still)

  • dusoft (unregistered) in reply to Melissa U

    Come on. This has been solved long time ago. Most companies today have a reservation hold period, e.g. countdown of 15 minutes to finish the booking. If you don't, the hold expires and the seat is free again. No race conditions possible.

  • Ethan (unregistered) in reply to cellocgw

    It happens.

    I once ordered from a major distributor in Thief River Falls a connector that was listed as in stock. The confirmation email said it was in stock. About a day later they sent an email saying it was actually not.

    I also once ordered something on Ebay of which there was 1 in stock. I thought the order didn't go through. The listing still said 1 in stock. I ordered it again. Later on it turned out that the first order went through part of the way. I had to ask the bank to undo the charge.

  • (nodebb)

    "a robust rail system." We can rule out the USA as well.

  • (nodebb) in reply to Scragar

    If you're travelling with DB you've got bigger problems than race conditions. In fact "race" isn't a word you'd associate with DB, more like "delay" or "cancellation".

    For proper train roulette, try catching something like the EC172 "Orban's Pride" (although it may have got better since he was chucked out). DB at one end, MAV at the other. You also book a seat reservation one or more following trains so you know you've got a seat when that one breaks down.

  • no (unregistered) in reply to Scragar
    If the DB didn't allow two people on the same train to have the same seat then one transaction would fail.

    i don’t see why two people couldn’t reserve the same seat if one of them gets off the train before the other gets on :)

  • 516052 (unregistered) in reply to zomgwtf

    To be fair, I'd rather have diminished performance in my DB system than race conditions. I mean, have you ever seen how deadlocks look when trains are involved? It ain't pretty. xD

  • David Jackson (unregistered) in reply to no

    and indeed in the UK that does happen. On those TOCs that use paper seat reservations, the card with the information is places in the seat backrest. You can see things like "Manchester Victoria - Leeds , York - Scarborough" (I was on 1P21 yesterday, unit 185 144), although that's not my seat reservation.

  • Terry Merop (unregistered) in reply to n9ds

    "a robust rail system." We can rule out the USA as well.

    I really have to disagree. I have been riding trains for over forty years, in both the US and EU (and a handful of times in east Asia) and while there are issues, I cannot say that I have had any real problems traveling by rain in either one. The US has a much more expansive infrastructure. There is Amtrak which is nation wide, and there are hundreds if commuter lines as well (as in full size trains, not subway/metro or tram type units) all of which carry hundreds of people each day, mostly without incident.

    If you only go by what has been in the news over the years, then is it easy to get a biased picture, as they don't normally report when everything is working more or less well, but mainly when something negative happens.

    I have experienced good, mostly uneventful rail rides on both sides of the pond, and the same goes for delays and occasional problems on the tracks, which can and does happen everywhere.

  • (nodebb)

    Yes, a race condition. But it sounds like if Robert had raced a little faster, he would have won

  • Neveranull (unregistered)

    Yes, the train seat should be reserved until the payment is confirmed. It’s like buying concert tickets online. Suppose they kept selling the same seat over and over while the first customer to reserve it was still entering his credit card number. They don’t do that. They hold the seat for a certain number of minutes to allow the payment to go through.

  • Noctew (unregistered) in reply to Melissa U

    Still, not ideal go go this route. There are train services in Europe where no reservation = no seat = the train leaves without you. I think France operates this way, so when a car is missing - bad luck for the passengers which were supposed to be in that car.

    And then there is the German model where people are literally sitting on the floor when half the train is missing, or when those passengers thought "I bet it's not full, so I'll skip the reservation".

  • Fred (unregistered) in reply to zomgwtf

    I traveled from Hamburg to Berlin and back last weekend. I am shocked, surprised, and slightly disappointed, that everything went smoothly. Arrived in Berlin 2 minutes behind schedule, and arrived back in Hamburg on time.

    Now the only story I have to tell is: "I had to visit the board bistro myself because the waiting staff was busy". :/

  • Anonymous (unregistered) in reply to Scragar

    For sure this happens on Deutsche Bahn, so yes, there were DB issues.

Leave a comment on “Racing Trains”

Log In or post as a guest

Replying to comment #705177:

« Return to Article