Rapid formation of bubbles in magma may trigger sudden volcanic eruptions