Skip to content

Commit

Permalink
deploy: 77d79f2
Browse files Browse the repository at this point in the history
  • Loading branch information
l10178 committed Dec 8, 2023
1 parent 3e5135e commit 22eb4e3
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions blog/duplicate-transfer-encoding-chunked/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions blog/index.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on XLabs</title><link>https://www.xlabs.club/blog/</link><description>Recent content in Blog on XLabs</description><generator>Hugo -- gohugo.io</generator><language>zh</language><copyright>Copyright (c) 2020-2023 XLabs Club</copyright><lastBuildDate>Thu, 07 Sep 2023 16:21:44 +0200</lastBuildDate><atom:link href="https://www.xlabs.club/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>重复 Transfer-Encoding Header 引起的服务 500 问题</title><link>https://www.xlabs.club/blog/duplicate-transfer-encoding-chunked/</link><pubDate>Sun, 26 Nov 2023 10:21:44 +0800</pubDate><guid>https://www.xlabs.club/blog/duplicate-transfer-encoding-chunked/</guid><description>一个 Spring Boot 应用服务,提供了一个简单的查询接口,本身运行很正常,通过 curl 或任何其他 http client 请求都没有问题。
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on XLabs</title><link>https://www.xlabs.club/blog/</link><description>Recent content in Blog on XLabs</description><generator>Hugo -- gohugo.io</generator><language>zh</language><copyright>Copyright (c) 2020-2023 XLabs Club</copyright><lastBuildDate>Thu, 07 Sep 2023 16:21:44 +0200</lastBuildDate><atom:link href="https://www.xlabs.club/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>重复 Transfer-Encoding Header 引起的服务 500 问题</title><link>https://www.xlabs.club/blog/duplicate-transfer-encoding-chunked/</link><pubDate>Sun, 26 Nov 2023 10:21:44 +0800</pubDate><guid>https://www.xlabs.club/blog/duplicate-transfer-encoding-chunked/</guid><description>我有一个 Spring Boot 应用服务,提供了一些简单的查询接口,本身运行很正常,通过 curl 或其他 http 客户端 localhost 请求都没有问题。
某天通过 Traefik 代理了此服务,经过代理后再访问,某个接口一直都是 500 internal server error,其他接口都没有问题。通过 tcpdump 抓包发现,应用服务并没有返回任何 500 错误,而且 Traefik 本身也没有错误日志。
根据网上经验排查了 SSL 证书问题、路径问题、消息体太大问题,都一一否定。最后无意间看了一眼 Response Header,发现 Spring Boot 应用返回了两个 Transfer-Encoding: chunked Header。
根据网上经验排查了 Traefik SSL 证书问题、路径问题、消息体太大问题、请求 Header 不合规问题,都一一否定。最后无意间看了一眼 Response Header,发现 Spring Boot 应用返回了两个 Transfer-Encoding: chunked Header。
再根据此 Header 搜索,发现果然有人遇到过类似问题,请参考这几个链接。
https://github.com/traefik/traefik/issues/7741 https://github.com/spring-projects/spring-framework/issues/21523 https://github.com/spring-projects/spring-boot/issues/37646 https://stackoverflow.com/questions/77042701/nginx-upstream-sent-duplicate-header-line-transfer-encoding-chunked-previo 从上面链接描述中可知,不仅 Traefik 会出现此问题,nginx 包含以 nginx 为基础的 ingress 也会出现同样问题,不过 nginx 返回错误码是 502。
我所使用的 Traefik(2.10.x) 和 Spring Boot(2.7.x) 都是当前日期最新版本,目前仍然有问题。
出现此问题的代码类似如下。
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.client.RestTemplate; @Controller @RequestMapping(&amp;#34;/status&amp;#34;) public class StatusController { @Autowired private RestTemplate restTemplate; @GetMapping(value = &amp;#34;/test&amp;#34;) public ResponseEntity&amp;lt;String&amp;gt; getStatus() { return restTemplate.</description></item><item><title>K8S 容器 PID 限制引起的 OOM</title><link>https://www.xlabs.club/blog/k8s-pid-limiting-oom/</link><pubDate>Thu, 07 Sep 2023 16:21:44 +0800</pubDate><guid>https://www.xlabs.club/blog/k8s-pid-limiting-oom/</guid><description>问题描述:
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.</description></item><item><title>K8S 容器 PID 限制引起的 OOM</title><link>https://www.xlabs.club/blog/k8s-pid-limiting-oom/</link><pubDate>Thu, 07 Sep 2023 16:21:44 +0800</pubDate><guid>https://www.xlabs.club/blog/k8s-pid-limiting-oom/</guid><description>问题描述:
一个 Java 应用跑在 K8S 容器内,Pod 内只有 Java 这一个进程。应用跑了一段时间后,CPU、内存占用都不高,但是却出现以下 OutOfMemoryError 错误。
Exception in thread &amp;#34;slow-fetch-15&amp;#34; java.lang.OutOfMemoryError: unable to create new native thread 428 at java.lang.Thread.start0(Native Method) 429 at java.lang.Thread.start(Thread.java:719) 430 at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:957) 431 at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1025) 432 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 433 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 进入 Pod 内,尝试执行任何操作,又会出现 unable to start container process 错误。
一开始怀疑是内存不足,调大了内存,同时也缩小了 Java 的 xss, 都不起作用。
Expand Down
Loading

0 comments on commit 22eb4e3

Please sign in to comment.