The code that routes packets in RoutingTableImpl is structured as follows.
The condition of the second block, however, is:
This will cause any stanza that is addressed to a non-existing subdomain to be processed by the S2S routines. In effect, they get queued forever, which causes a memory leak.
Many thanks to Lars Hoogweg for reporting this issue.
The code now checks the address of a packet first. Only after a processing routine has been picked, the validity of the address is checked.
I have split up the individual processes that were defined in routePacket(). Now, every process has its own method. This makes mistakes like the one that caused this issue very visible.