ArticleslgStudy

computer science

Sorcerer's Apprentice syndrome

Sorcerer's Apprentice syndrome is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Sorcerer's Apprentice syndrome rather than just read about it. In short: Sorcerer's Apprentice syndrome (SAS) is a network protocol flaw in the original versions of TFTP. It was named after Goethe's 1797 poem "Der Zauberlehrling" (popularized in the US by the "Sorcerer's Apprentice" segment of the 1940 animated film Fantasia), because the details of its operation closely resemble the disaster that befalls the sorcerer's apprentice: the problem resulted in an ever-growing replication of e…

Sorcerer's Apprentice syndrome — main illustration
Sorcerer's Apprentice syndrome — illustration

Key takeaways

  • Sorcerer's Apprentice syndrome belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Sorcerer's Apprentice syndrome to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Sorcerer's Apprentice syndrome from memory before moving on to harder problems.

Reference excerpt

Sorcerer's Apprentice syndrome (SAS) is a network protocol flaw in the original versions of TFTP. It was named after Goethe's 1797 poem "Der Zauberlehrling" (popularized in the US by the "Sorcerer's Apprentice" segment of the 1940 animated film Fantasia), because the details of its operation closely resemble the disaster that befalls the sorcerer's apprentice: the problem resulted in an ever-growing replication of every packet in the transfer. The problem occurred because of a known failure mode of the internetwork which, through a mistake on the part of the TFTP protocol designers, was not taken into account when the protocol was designed; the failure mode interacted with several details of the mechanisms of TFTP to produce SAS.

Technical background TFTP operates in simple lock-step: there is only ever one packet outstanding at any time, and every packet received by either party caused one packet to be sent in reply (until the termination of the transfer). The TFTP specification said that any time any packet was received, the receiver was required to send the appropriate reply packet. Thus, the receipt of a block of data triggered the sending of an acknowledgement, and the receipt of an acknowledgement triggered the sending of the next data block. TFTP also, like all protocols designed to operate across an unreliable network, includes timeouts. After sending a packet, it expects a reply, so it starts a timer. If the timer expires with no reply received, it takes some action; typically re-sending the original packet.

Details SAS occurred when a packet was not lost in the internetwork, but rather simply delayed, and later successfully delivered, after a timeout had occurred (on either side). The timeout causes a second copy of the previous packet to be sent to replace the "lost" packet. However, the first copy was not lost, and since, according to the TFTP specification, receipt of any packet always forced the generation of a reply packet, two replies were generated (one to each copy). Those forced the generation of two replies to them, and so on. A typical scenario was as follows:

Computer S (source) sends data block X to computer D (destination) Computer D receives block X, and sends an acknowledgement for X back to S The packet containing the acknowledgement for X is delayed in the internetwork Computer S times out, and resends data block X to D Computer S receives the delayed acknowledgement for X, and sends data block X+1 Computer D receives the second copy of block X, and sends another acknowledgement for X back to S Computer D receives block X+1, and sends an acknowledgement for X+1 back to S Computer S receives the second acknowledgement for X, and sends a second copy of data block X+1 Computer S receives the acknowledgement for X+1, and sends data block X+2 Computer D receives the second copy of block X+1, and sends another acknowledgement for X+1 back to S Computer D receives block X+2, and sends an acknowledgement for X+2 back to S It will be seen that at this point the situation is now stable, and repeats; every packet from then on is duplicated (that is, two identical copies are sent across the internetwork). Even worse, the increased number of packets being sent around the internetwork was likely to cause congestion, which was likely to cause a packet to be delayed past the timeout yet again, which would then cause yet another duplicate packet to be generated by a timeout, and from then on a third copy of each packet would be sent. Needless to say, at that point, the situation would usually snowball, and further copies would be generated — hence the name given to this pattern of behaviour. For a small file, the transfer would complete, and the duplicate packets would eventually drain from the internetwork. If the file were large, however, congestive collapse would result, and only when the transfer failed would the mass of packets drain from the internetwork.

Solution The fix to SAS involved modifying the TFTP specification to break the loop. Only the first instance of a received acknowledgment should cause the next data block to be sent; further copies of the acknowledgment for a particular data block would be ignored, thus breaking the retransmission loop. In the new version of the protocol, a block would only be retransmitted on timeout. This change also makes it possible to simplify the implementation of the receiving end (often, a bootstrap program written in a low-level language) by omitting the retransmission timer, as any lost packet would cause retransmission of the last packet sent by the sender. However, keeping the timer has its benefits, such as dealing with lost ACKs more efficiently.

References

Illustrations

Sorcerer's Apprentice syndrome: Statue of Mickey Mouse as the Sorcerer's Apprentice in Fantasia at Hong Kong Disneyland. In the story, the apprentice's enchanted broom multiplies uncontrollably.
Statue of Mickey Mouse as the Sorcerer's Apprentice in Fantasia at Hong Kong Disneyland. In the story, the apprentice's enchanted broom multiplies uncontrollably.

Worked examples

Example 1 — a first encounter with Sorcerer's Apprentice syndrome

Start with the simplest possible case. Write down what Sorcerer's Apprentice syndrome claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Sorcerer's Apprentice syndrome before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Sorcerer's Apprentice syndrome ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Sorcerer's Apprentice syndrome

In research
Sorcerer's Apprentice syndrome appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Sorcerer's Apprentice syndrome in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Sorcerer's Apprentice syndrome is common in secondary-school and first-year university syllabi. It links to neighbouring topics Internet architecture, Network protocols, Software bugs, so understanding it makes those chapters shorter.
In everyday life
Look for Sorcerer's Apprentice syndrome outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Sorcerer's Apprentice syndrome” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Sorcerer's Apprentice syndrome in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Sorcerer's Apprentice syndrome means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Sorcerer's Apprentice syndrome out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Sorcerer's Apprentice syndrome in simple terms?

Sorcerer's Apprentice syndrome (SAS) is a network protocol flaw in the original versions of TFTP. It was named after Goethe's 1797 poem "Der Zauberlehrling" (popularized in the US by the "Sorcerer's Apprentice" segment of the 1940 animated film Fantasia), because the details of its operation closel…

Why does Sorcerer's Apprentice syndrome matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Sorcerer's Apprentice syndrome?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Sorcerer's Apprentice syndrome.

Tags

  • Internet architecture
  • Network protocols
  • Software bugs

Keep exploring