My visitor visa to Canada expires on 11th August 2019. If I arrive in April 2019 can I stay for six months, or do I have to leave before my visa expires?
Canada is a "visa must be valid on arrival" country. When you arrive, the officer should indicate how long you may stay. This is usually six months, and it is not related to the date on which the visa expires.
However, you will need to be able to explain to the officer's satisfaction that you can comply with the requirements associated with your visa. For example, if you are entering as a visitor, you should be able to show that you have (among other things) a way of supporting yourself without working in Canada and a reason to return to your country of residence. If the officer is not satisfied that you will comply with the requirements that apply to your visa category, you will not be allowed to enter Canada.
For more information, see Temporary resident visa validity (expiry dates):
The expiry date on the TRV is the date by which the visa must be used to seek admission into Canada. If the visa is not used on or before that date, it ceases to be valid.
The validity date is NOT the suggested duration of the visit. At the port of entry examination, CBSA officers determine the length of time temporary residents are authorized to stay in Canada.
Typically, when officers are satisfied that the foreign nationals are admissible, entry is granted for a six-month period, unless they hold a Parent and Grandparent Extended Stay Temporary Resident Visa (PG-1 or letter of introduction from the visa office), in which case entry may be granted for a period of up to two years on each entry.
There is some additional information on that page relating to short trips to the US and/or the St. Pierre and Miquelon.