Abstract.A detailed analysis of the adiabatic-piston problem reveals peculiar dynamical features that challenge the general belief that isolated systems necessarily reach a static equilibrium state. In particular, the fact that the piston behaves like a perpetuum mobile, i.e., it never stops but keeps wandering, undergoing sizable oscillations, around the position corresponding to maximum entropy, has remarkable implications on the entropy variations of the system and on the validity of the second law when dealing with systems of mesoscopic dimensions.The adiabatic-piston problem is a peculiar example in thermodynamics [1], which has recently been the object of renewed interest [2], [3]. We refer to the model case of an adiabatic cylinder divided into two regions A and B by a movable, frictionless, perfectly insulating piston. Both A and B contain an equal amount of the same perfect gas. We assume the piston to be held up to time t=0 by latches, so that the gases in A and B are initially characterized by well-defined equilibrium states, respectively corresponding to temperatures and volumes TA=Ti(0), VA= SX (