<s>
Sorcerer	B-Protocol
's	I-Protocol
Apprentice	I-Protocol
Syndrome	I-Protocol
(	O
SAS	O
)	O
is	O
a	O
network	O
protocol	O
flaw	O
in	O
the	O
original	O
versions	O
of	O
TFTP	B-Device
.	O
</s>
<s>
It	O
was	O
named	O
after	O
Goethe	O
's	O
1797	O
poem	O
"	O
Der	O
Zauberlehrling	O
"	O
(	O
popularized	O
by	O
the	O
"	O
Sorcerer	O
's	O
Apprentice	O
"	O
segment	O
of	O
the	O
1940	O
animated	O
film	O
Fantasia	O
)	O
,	O
because	O
the	O
details	O
of	O
its	O
operation	O
closely	O
resemble	O
the	O
disaster	O
that	O
befalls	O
the	O
sorcerer	O
's	O
apprentice	O
:	O
the	O
problem	O
resulted	O
in	O
an	O
ever-growing	O
replication	O
of	O
every	O
packet	B-Protocol
in	O
the	O
transfer	O
.	O
</s>
<s>
The	O
problem	O
occurred	O
because	O
of	O
a	O
known	O
failure	O
mode	O
of	O
the	O
internetwork	B-Architecture
which	O
,	O
through	O
a	O
mistake	O
on	O
the	O
part	O
of	O
the	O
TFTP	B-Device
protocol	O
designers	O
,	O
was	O
not	O
taken	O
into	O
account	O
when	O
the	O
protocol	O
was	O
designed	O
;	O
the	O
failure	O
mode	O
interacted	O
with	O
several	O
details	O
of	O
the	O
mechanisms	O
of	O
TFTP	B-Device
to	O
produce	O
SAS	O
.	O
</s>
<s>
TFTP	B-Device
operates	O
in	O
simple	O
lock-step	B-General_Concept
:	O
there	O
is	O
only	O
ever	O
one	O
packet	B-Protocol
outstanding	O
at	O
any	O
time	O
,	O
and	O
every	O
packet	B-Protocol
received	O
by	O
either	O
party	O
caused	O
one	O
packet	B-Protocol
to	O
be	O
sent	O
in	O
reply	O
(	O
until	O
the	O
termination	O
of	O
the	O
transfer	O
)	O
.	O
</s>
<s>
The	O
TFTP	B-Device
specification	O
said	O
that	O
any	O
time	O
any	O
packet	B-Protocol
was	O
received	O
,	O
the	O
receiver	O
was	O
required	O
to	O
send	O
the	O
appropriate	O
reply	O
packet	B-Protocol
.	O
</s>
<s>
TFTP	B-Device
also	O
,	O
like	O
all	O
protocols	O
designed	O
to	O
operate	O
across	O
an	O
unreliable	O
network	O
,	O
includes	O
timeouts	O
.	O
</s>
<s>
After	O
sending	O
a	O
packet	B-Protocol
,	O
it	O
expects	O
a	O
reply	O
,	O
so	O
it	O
starts	O
a	O
timer	O
.	O
</s>
<s>
If	O
the	O
timer	O
expires	O
with	O
no	O
reply	O
received	O
,	O
it	O
takes	O
some	O
action	O
;	O
typically	O
re-sending	O
the	O
original	O
packet	B-Protocol
.	O
</s>
<s>
SAS	O
occurred	O
when	O
a	O
packet	B-Protocol
was	O
not	O
lost	O
in	O
the	O
internetwork	B-Architecture
,	O
but	O
rather	O
simply	O
delayed	O
,	O
and	O
later	O
successfully	O
delivered	O
,	O
after	O
a	O
timeout	O
had	O
occurred	O
(	O
on	O
either	O
side	O
)	O
.	O
</s>
<s>
The	O
timeout	O
causes	O
a	O
second	O
copy	O
of	O
the	O
previous	O
packet	B-Protocol
to	O
be	O
sent	O
to	O
replace	O
the	O
'	O
lost	O
 '	O
packet	B-Protocol
.	O
</s>
<s>
However	O
,	O
the	O
first	O
copy	O
was	O
not	O
lost	O
,	O
and	O
since	O
,	O
according	O
to	O
the	O
TFTP	B-Device
specification	O
,	O
receipt	O
of	O
any	O
packet	B-Protocol
always	O
forced	O
the	O
generation	O
of	O
a	O
reply	O
packet	B-Protocol
,	O
two	O
replies	O
were	O
generated	O
(	O
one	O
to	O
each	O
copy	O
)	O
.	O
</s>
<s>
It	O
will	O
be	O
seen	O
that	O
at	O
this	O
point	O
the	O
situation	O
is	O
now	O
stable	O
,	O
and	O
repeats	O
;	O
every	O
packet	B-Protocol
from	O
then	O
on	O
is	O
duplicated	O
(	O
that	O
is	O
,	O
two	O
identical	O
copies	O
are	O
sent	O
across	O
the	O
internetwork	B-Architecture
)	O
.	O
</s>
<s>
Even	O
worse	O
,	O
the	O
increased	O
number	O
of	O
packets	B-Protocol
being	O
sent	O
around	O
the	O
internetwork	B-Architecture
was	O
likely	O
to	O
cause	O
congestion	B-Protocol
,	O
which	O
was	O
likely	O
to	O
cause	O
a	O
packet	B-Protocol
to	O
be	O
delayed	O
past	O
the	O
timeout	O
yet	O
again	O
,	O
which	O
would	O
then	O
cause	O
yet	O
another	O
duplicate	O
packet	B-Protocol
to	O
be	O
generated	O
by	O
a	O
timeout	O
,	O
and	O
from	O
then	O
on	O
a	O
third	O
copy	O
of	O
each	O
packet	B-Protocol
would	O
be	O
sent	O
.	O
</s>
<s>
For	O
a	O
small	O
file	O
,	O
the	O
transfer	O
would	O
complete	O
,	O
and	O
the	O
duplicate	O
packets	B-Protocol
would	O
eventually	O
drain	O
from	O
the	O
internetwork	B-Architecture
.	O
</s>
<s>
If	O
the	O
file	O
were	O
large	O
,	O
however	O
,	O
congestive	O
collapse	O
would	O
result	O
,	O
and	O
only	O
when	O
the	O
transfer	O
failed	O
would	O
the	O
mass	O
of	O
packets	B-Protocol
drain	O
from	O
the	O
internetwork	B-Architecture
.	O
</s>
<s>
The	O
fix	O
to	O
SAS	O
involved	O
modifying	O
the	O
TFTP	B-Device
specification	O
to	O
break	O
the	O
loop	O
.	O
</s>
<s>
Only	O
the	O
first	O
instance	O
of	O
a	O
received	O
acknowledgment	O
should	O
cause	O
the	O
next	O
data	O
block	O
to	O
be	O
sent	O
;	O
further	O
copies	O
of	O
the	O
acknowledgment	O
for	O
a	O
particular	O
data	O
block	O
would	O
be	O
ignored	O
,	O
thus	O
breaking	O
the	O
retransmission	B-Protocol
loop	O
.	O
</s>
<s>
This	O
change	O
also	O
makes	O
it	O
possible	O
to	O
simplify	O
the	O
implementation	O
of	O
the	O
receiving	O
end	O
(	O
often	O
,	O
a	O
bootstrap	O
program	O
written	O
in	O
a	O
low-level	O
language	O
)	O
by	O
omitting	O
the	O
retransmission	B-Protocol
timer	O
,	O
as	O
any	O
lost	O
packet	B-Protocol
would	O
cause	O
retransmission	B-Protocol
of	O
the	O
last	O
packet	B-Protocol
sent	O
by	O
the	O
sender	O
.	O
</s>
