Contract is formed and unforeseeable event occurs
The nature of the law of contracts is that of, in any agreements made by the parties, unforeseen events may occur which creates an obstacle to achieve the purpose of the agreement made by the parties. A prevalent situation in the law of contracts is when the contract between two parties is formed and an unforeseeable event occurs which is beyond the control of the parties where it is now impossible to continue the contract. This is also known as impossibility of performances which prevents the purpose of the contract to be fulfilled. Nevertheless, when an impossibility to perform occurs in any agreement, it is norm that the agreements to be deemed as discharged under the doctrine of frustration.
This differs from contracts that are void ab initio in which the parties are not liable for any discharge and termination because the contract is invalid since the beginning.
It is necessary to distinguish void ab initio from frustration.
So what is void ab initio?
Void ab initio literally means ‘void from the beginning’. In terms of contract law, contracts which are void ab initio mean that it is void from the very beginning where the agreement was made. It was never a contract, therefore it can’t create any legal relation, and therefore parties of the contracts could not rely on what was agreed in said agreement  . In an event of frustration, the contract is void. However, it is subjected to certain exceptions which will be explained later. 
Void ab initio contracts can never be void. In other words, agreement which is void ab initio is actually not a contract at all to begin with, for it is only an agreement, keep in mind that not all agreements are contracts but all contracts are an agreement. 
A contract may be discharged by frustration, performance, breach or an agreement. A contract is discharged by frustration only under a special case when an impossibility of performances occurs after the contract was made. A contract is frustrated when subsequent to its formation, a change of circumstances renders the contract legally or physically impossible of performance  .At the beginning, the Common Law system adopted a very rigid approach where the parties are bound to perform their obligation even though it is impossible. The case of Paradine and Jane  is an example where the strict literal concept of frustration was insisted upon. In this case a tenant of a farm was dispossessed for two years following an invasion by Prince Rupert of Germany. The tenant claimed that he was not liable to pay rent for the two-year period. The court held in favour of the landlord: ‘Now the rent is a duty created by the parties upon the reservation, and had there been a covenant to pay it, there had been no question but the lessee must have made it good, notwithstanding the interruption by enemies, for the law would not protect him beyond his own agreement . . .’The justi"cation for refusing to discharge the parties from their obligations was that the parties could, if they wished, have included a specific term in the contract known as the force majeure or hardship clauses to deal with the eventuality.
Nevertheless, the evolution of the doctrine of frustration can be seen in the case of Taylor v Caldwell  where Lord Blackburn J adopted a more liberal approach towards the law .In this case the plaintiffs entered into a contract by which the defendants agreed to let the plaintiffs have the use of the Surrey Gardens and music hall. After the making of the agreement, but before the "rst day on which a concert was to be given, the music hall was destroyed by fire. The plaintiffs brought a claim against the defendant for breach of contract in failing to supply the hall. The Court of Queen’s Bench held that the contract was discharged for frustration on the ground that it contained an implied condition that the parties shall be excused from performance if the subject matter of the contract is destroyed. 
The definition of doctrine of frustration in Malaysia can be derived under Section 57(2) Contracts Act.
“Contract to do act afterwards becoming impossible or unlawful:
(2) A contract to do an act which, after the contract is made,becomes impossible, or by reason of some event which the promisor could not prevent, unlawful, becomes void when the act becomes impossible or unlawful."
The term frustration is not used but instead referred to as impossibility and unlawful event. Unfortunately the absence of the definition of the word impossible suggests that common law principles will inevitably come into play whenever the court seek to ascertain whether or not the doctrine of frustration is applicable. In support of this, Sinnadurai Visu had also had in his view that when it comes to Section 57 of the Contracts Act, the two main instances, impossible and unlawful shall be envisaged. 
Contrary to frustration, the instance for void contract is the illegality of the object of the agreement. Reason why we are including the provisions for void agreement is to clarify the position of void agreement in Malaysia content, for it somehow differs from the common law content. From Malaysian content, unlawfulness of the consideration is deemed to be void ab initio, this falls under Section 24 of the Contracts Act  but there is an exception for this section, the exception are stated in Section 26 of the Contracts Act. Then it is mistake made by both party regarding the agreement would also causes an agreement to be void, it is governed in Section 21 of the Contract Act 1950. Besides that is the restraint of marriage which falls under Section 27 of the Contract Act  , then is the restraint of legal proceeding falls under Section 29 of the Contracts Act  . Next is, when the meaning of agreement t is uncertain, it would void it, this is governed under Section 30 of the Contract Act. Then we have Section 31 of the Contract Act which provides agreement by ways of wager is void
Under Section 57(3) of the Contracts Act is a situation where a contract is not frustrated but void ab initio.
“(c) A contracts to marry B, being already married to C, and being forbidden by the law to which he is subject to practise polygamy. A must make compensation to B for the loss caused to her by the non-performance of his promise.  "
The illustration shows that the doctrine of frustration can be only applied after the formation of the contract. Nevertheless, in illustration C of Section 57, it does not become unlawful because of the change of circumstances after the formation of the contract which A could not prevent. It is unlawful from the contract itself because polygamous marriage is illegal and hence, it is void ab initio and not frustrated.
Section 33 of the Contracts Act also revolves around the doctrine of frustration:
“(a) Contingent contracts to do or not to do anything if an uncertain future event happens cannot be enforced by law unless and until that event has happened.
(b) If the event becomes impossible, such contracts become void."
Even here, it is clearly stipulated that frustration occurs after the contract is made ie ..until that event has happened. In Goh Yew Chew & Anor v Soh Kian Tee  .The appellants agreed to construct two buildings on land belonging to the respondent. The respondent paid $5,000 to the appellant as earnest money and later it was found that owing to an encroachment of a neighbour’s house into the land it was not possible to build the buildings according to the plans.
The respondent claims back his $5,000.It was held that in the circumstances it was impossible ab initio to perform the contract. The respondent was entitled to the balance of the deposit after deduction of all reasonable expenses incurred by the appellants. 
In any case where the occurrence of a frustrating event was self induced and caused by a default of a party, the party will not be discharged of the contract.  In the case of Standard Chatered Bank v Kuala Lumpur Landmark Sdn Bhd where the plaintiff loaned $20 million to a third party and the defendant company charged certain lands to the plaintiffs to secure repayment of the loan. After the third party did not make any payment of the loan and interest, the plaintiffs commenced legal proceedings  for sale of charged lands under the in order to satisfy the debt. On 3rd June 1989, it was agreed that the defendant should pay $2million to the plaintiffs and deliver a bank guarantee providing for the payment of $18m to the plaintiffs on demand before 22nd December 1989.The legal proceedings were suspended and the defendants paid the $2million.However,an injunction was served by Monsia Investment Pte Ltd restraining both parties from completing any manner upon the redemption of the agreement. As a result the defendants could not comply with the redemption agreement and pay $18million to the plaintiffs.
The Plaintiffs then revived and pursued their claim against the defendants for foreclosure of the charged lands in court. Allowing the plaintiffs application, it was held that, due to the injunction obtained by Monsia Investment Pte Ltd which restrained the parties for redemption, the agreement had been rendered impossible to perform within the terms and conditions of the agreement. The very assense of the agreement had been frustrated as the performances of the same would be a radical change of its original terms and condition. The right of foreclosure is stated under a statutory right  .Here, the redemption agreement suspending the right of the plaintiffs to exercise their right of foreclosure had been frustrated by the injunction.
The courts will not permit the doctrine to be used as a means of escape for a party that has simply entered into a bad bargain. Similarly, the courts are reluctant to hold that a contract has been discharged merely because its purpose has been frustrated.  IN Krell’s case the defendant had agreed to hire from the plaintiff some rooms to watch the coronation procession of King Edward VII. The King became seriously ill and the coronation processions were postponed. The defendant refused to pay the balance and the plaintiff brought a claim for the outstanding balance. The defendant counter-claimed to recover the £25 deposit he had paid. It was held that there was an implied term in the contract that the procession should take place. Accordingly, he gave judgment for the defendant on both the claim and the counter claim. The Court of Appeal dismissed the appeal, holding that the contract had been frustrated.
Another common cause of frustration is during an outbreak of war or interference by the government. However in such cases, the contract depends on the circumstances of each case.  Another case, Berney v Tronoh Mines  , it was held that the invasion of Malaya by Japanese forces frustrated the contract. It can be seen in this case that the Malaysian court recognizes a contract can be frustrated and discharged by breach or default of either parties.
When a contract is discharged by frustration, the contract becomes void and it comes to an end.  However, the contract is not void ab initio as the contract will be only terminated as to the future only.