yingqin678 / experience Goto Github PK
View Code? Open in Web Editor NEW解决问题的经验
解决问题的经验
int转double:https://www.jianshu.com/p/eafce9689e7d
启动报错:zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for
原因:zk客户端与服务器版本不一致:https://www.jianshu.com/p/384442962e86
强制卸载nfs:nfsstat -m
umount -f/l
maven编码gbk的不可映射字符:https://www.cnblogs.com/xdp-gacl/p/4239006.html
mybatis useGeneratedKeys无法返回主键解决:https://blog.csdn.net/qq_29992111/article/details/80530195
系统架构:NGINX+Tomcat,NGINX为HTTPS服务,Tomcat至NGINX为HTTP
客户端:对接两种客户端
服务器:使用spring mvc框架
问题描述:服务器提供一个下载图片接口,通过将文件流写入响应stream中,并设置header中contentType字段提供客户端下载图片(图片为敏感信息,不能通过静态URL下载),一种客户端可以正常通过接口下载,另一种客户端请求返回406(406解释:https://segmentfault.com/q/1010000006745584)
解决思路:
从406描述中可以推测,大概率是请求头中accept的问题,那么咱们就把两种客户端的accept都抓出来对比一下,看下是具体是哪个(此时尚不清楚是哪个环节返回的406),然后再根据请求环节一步步找出返回406的点,并设法解决。
解决步骤:
1.NGINX对外是HTTPS服务,抓取得请求是密文,无法查看,只能抓Tomcat日志,看是否请求到了后端被拒绝的,使用tcpdump抓包,抓取两种客户端请求,发现请求正常的客户端,accept包含*/,为接受所有响应类型,因此没有此类问题;406的请求accept为image/wpn;image/;问题就在某个环节的响应类型不在accept之中。
2.为方便定位,使用本地Tomcat进行调测,发现相同406请求头,本地是正常返回的,那么问题来了,本地和环境上的区别只是存在部分开源jar包进行过升级,看来罪魁祸首快要找到了。
3经过排查,发现问题就是spring框架的包升级导致的。从springframe的listener进入进行调试,很快定位到问题的原因。
4.原因:4.3.16版本未对producers于accept进行校验,5.X(具体版本号不记得了)校验了producers是否在accept中存在。我们requestMapping时,未配置producers,默认值是text/html,不在image/*中,返回406错误,
5.解决:找到问题原因,在对应方法上增加标注:producers:image/jpg,即解决问题
http://www.it1352.com/542429.html
出现大量日志
"http-bio-8080-exec-168" #257 daemon prio=5 os_prio=0 tid=0x00007f52ec5cc800 nid=0x501 waiting on condition [0x00007f52dcc03000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x000000070b8cb2a8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at org.apache.kafka.clients.producer.internals.BufferPool.allocate(BufferPool.java:137)
at org.apache.kafka.clients.producer.internals.RecordAccumulator.append(RecordAccumulator.java:157)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:338)
at com.huawei.opengw.mq.remoting.kafka.version082.KafkaProducer082.send(KafkaProducer082.java:122)
at com.huawei.opengw.mq.rpc.MQInvoker.doInvoke(MQInvoker.java:216)
at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:142)
at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:73)
at com.alibaba.dubbo.rpc.filter.GenericImplFilter.invoke(GenericImplFilter.java:172)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:47)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
at com.huawei.opengw.dubboex.rpc.cluster.opengw.support.MFailoverClusterInvoker.doInvoke(MFailoverClusterInvoker.java:115)
at com.huawei.opengw.dubboex.rpc.cluster.opengw.support.AbstractMClusterInvoker.invoke(AbstractMClusterInvoker.java:344)
at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:70)
at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:51)
at com.sun.proxy.$Proxy46.$invoke(Unknown Source)
at com.huawei.opengw.mq.api.MQClient.sendMessage(MQClient.java:567)
at com.huawei.skytone.dmq.DmqClient.sendMessage(DmqClient.java:377)
at com.huawei.skytone.dmq.DmqClient.sendMessage(DmqClient.java:349)
at com.huawei.vsim.common.dmq.push.PushMsgService.postApkLogOnMSG(PushMsgService.java:90)
at com.huawei.vsim.rest.v1.ifs.ReportLog.sendDMQ(ReportLog.java:278)
at com.huawei.vsim.rest.v1.ifs.ReportLog.service(ReportLog.java:180)
at com.huawei.vsim.rest.v1.ifs.ReportLog.service(ReportLog.java:45)
at com.huawei.vsim.rest.v1.ClientServlet.execute(ClientServlet.java:437)
at com.huawei.vsim.rest.v1.ClientServlet.doRequest(ClientServlet.java:354)
at com.huawei.vsim.rest.v1.ClientServlet.doPost(ClientServlet.java:185)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:458)
at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:177)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.huawei.vsim.common.container.EncodingFilter.doFilter(EncodingFilter.java:63)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
- locked <0x000000070b8cc340> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.