Posts

Showing posts from 2022

Infinite loop in while-hasNext

Image
This is quite a common approach to interate over a collection while (iterator.hasNext()) {     UnitOfWork  work = iterator.next();     do(work); } But what if the iteration is not over a simple in-memory data structure, but we are interacting with a another subsystem or application over a similar interface.     In such setups it is highly recommended system A implements a protection logic for duplicate work. It happened to me recently that system B started to respond with the same UnitOfWork over and over, rendering system A into an infinite loop.   The protection may consist in comparing previous UnitOfWork with the new one and if they are the same either gracefully ignore it or report an error (eg: break the loop). Another approach would be to persist some sort of identification of the UnitOfWork (eg: id, signature). If a new UnitOfWork has the same identifier as something that we have in the past work storage, again we can ignore and/...

SOAP endpoint returning 400 Bad Request

This SOAP request which used to work every time now suddenly started to receive 400 Bad Request.   Spent hours analyzing logs without any hint towards the cause of problem. The second day we are told that the Web App is also reporting bad request on simple HTTP calls. We are analyzing Apache access logs and than accidentally we see something unbelievable. The /tmp partition is only 11 MB and 30% is already in use.   Apache is using /tmp to store temporary files specially when uploads are performed. Our App also relies on /tmp to store temporary files, other frameworks or apps from time to time might need /tmp files. Since /tmp is a special partition, various Linux distributions or kernels might react differently when the space becomes full. So quite a random situation.