Section 29. If a person arrested on execution becomes an insolvent debtor under the laws of this commonwealth or a bankrupt under the laws of the United States, he shall be discharged upon his application to a district court in the county where the arrest was made, after such notice as the court shall order.