I was wondering about what people do to solve this problem. But, of course, this doesn't solve the problem. I get this one out. Keeping resources on a particular server may be necessary due to the inability of the client to keep the resources or the inability of the network to transport the resources back and forth. As another poster pointed out, here we have the difference between stateless and stateful servers.
Stateless servers are to be preferred when possible, because they are simpler.
But in some applications the complexity of a stateful server will be offset by reducing complexity in the many clients. The problem in the original question comes from incomplete analysis of the client-server roles. In the example, we have the ultimate client, which talks to server 1, which in turn is a client of server 2, which allocates state. Server 1 needs to know that server 2 has allocated state for it, thus making server 1 hold state in proxy for the ultimate client. When server 1 detects that the client has terminated, it must deallocate the state that it holds, by informing server 2 that the session is over.