@@ -5,7 +5,7 @@ use Test::Nginx::Socket;
5
5
6
6
# repeat_each(2);
7
7
8
- plan tests => repeat_each() * (4 * blocks() + 2 );
8
+ plan tests => repeat_each() * (4 * blocks() + 4 );
9
9
10
10
$ENV {TEST_NGINX_MEMCACHED_PORT } ||= 11211;
11
11
@@ -489,3 +489,110 @@ I do like you
489
489
--- no_error_log
490
490
[error]
491
491
492
+
493
+
494
+ === TEST 15: exit(ngx.ERROR) in srcache_store
495
+ --- config
496
+ memc_read_timeout 200ms;
497
+ location /foo {
498
+ satisfy any;
499
+
500
+ default_type text/css;
501
+
502
+ srcache_store PUT /sub;
503
+
504
+ echo I do like you;
505
+ }
506
+
507
+ location /sub {
508
+ content_by_lua '
509
+ ngx.exit(ngx.ERROR)
510
+ ';
511
+ }
512
+ --- request
513
+ GET /foo
514
+ --- stap
515
+ F(ngx_http_upstream_finalize_request) {
516
+ printf("upstream fin req: error=%d eof=%d rc=%d\n",
517
+ $r->upstream->peer->connection->read->error,
518
+ $r->upstream->peer->connection->read->eof,
519
+ $rc)
520
+ print_ubacktrace()
521
+ }
522
+ F(ngx_connection_error) {
523
+ printf("conn err: %d: %s\n", $err, user_string($text))
524
+ #print_ubacktrace()
525
+ }
526
+ F(ngx_http_srcache_store_post_subrequest) {
527
+ printf("post subreq: rc=%d, status=%d\n", $rc, $r->headers_out->status)
528
+ #print_ubacktrace()
529
+ }
530
+ F(ngx_http_finalize_request) {
531
+ printf("finalize: %d\n", $rc)
532
+ }
533
+
534
+ --- stap_out
535
+ finalize: 0
536
+ finalize: -1
537
+ post subreq: rc=-1, status=0
538
+ finalize: 0
539
+ --- response_headers
540
+ Content-Type: text/css
541
+ --- response_body
542
+ I do like you
543
+ --- no_error_log
544
+ [error]
545
+
546
+
547
+
548
+ === TEST 16: exit(500) in srcache_store
549
+ --- config
550
+ memc_read_timeout 200ms;
551
+ location /foo {
552
+ satisfy any;
553
+
554
+ default_type text/css;
555
+
556
+ srcache_store PUT /sub;
557
+
558
+ echo I do like you;
559
+ }
560
+
561
+ location /sub {
562
+ return 500;
563
+ }
564
+ --- request
565
+ GET /foo
566
+ --- stap
567
+ F(ngx_http_upstream_finalize_request) {
568
+ printf("upstream fin req: error=%d eof=%d rc=%d\n",
569
+ $r->upstream->peer->connection->read->error,
570
+ $r->upstream->peer->connection->read->eof,
571
+ $rc)
572
+ print_ubacktrace()
573
+ }
574
+ F(ngx_connection_error) {
575
+ printf("conn err: %d: %s\n", $err, user_string($text))
576
+ #print_ubacktrace()
577
+ }
578
+ F(ngx_http_srcache_store_post_subrequest) {
579
+ printf("post subreq: rc=%d, status=%d\n", $rc, $r->headers_out->status)
580
+ #print_ubacktrace()
581
+ }
582
+ F(ngx_http_finalize_request) {
583
+ printf("finalize: %d\n", $rc)
584
+ }
585
+
586
+ --- stap_out
587
+ finalize: 0
588
+ finalize: 500
589
+ post subreq: rc=500, status=0
590
+ finalize: 0
591
+
592
+ --- response_headers
593
+ Content-Type: text/css
594
+ --- response_body
595
+ I do like you
596
+ --- no_error_log
597
+ [error]
598
+
0 commit comments