当新的WP_Query在post循环内时出现错误502

I am trying to set up custom post feeds inside a custom post single template. Code works fine outside the single template or any other query (pages, posts). But when inside a loop. it gives error 502 "The page request was canceled because it took too long to complete". Error log is empty.

$args2 = array(
      'post_type'   => 'payout',
      'post_status' => 'publish',
      'tax_query'   => array(
       array(
           'taxonomy' => 'pay_connection',
           'field'    => 'slug',
           'terms'    => '30'
           )
      )
);
$newquery = new WP_Query( $args2 );
if ( have_posts() ) while ($newquery->have_posts()) : $newquery->the_post();
     $custom = get_post_custom($post->ID);
     echo $custom['pay_start'][0];
     echo $custom['pay_end'][0];
     echo '$'. $custom['net_pay'][0];
  endwhile; 
  wp_reset_postdata();