A huge fire forced more than 22,000 people to flee an electronic music festival near Barcelona in an incident that organisers blamed on a technical fault.