Other times to quit:
When risk of failure is a career stain, and success does not mean promotions and pay raises.
When the project is almost out of funding.
When the manager doesn't value your contribution.
When it harms humanity.
When a better project comes along.
When you put your health, family, or quality of life at risk.
When it interferes with posting on HN.