Drupal flush all caches internal server error caused by node_modules
Are you getting an "ERR_EMPTY_RESPONSE" in Chrome or an "connection reinitialized" in Firefox? The headers returned are empty (0 bytes) and you've got segmentation faults in your apache logs.
Are you using tools like grunt or gulp? Chances are, the node_modules folder in your theme folder is causing this error. Origin is in the system_rebuild_theme_data() function which is called in drupal_flush_all_caches().
See for a solution this core patch: