js async.waterfall 异步嵌套执行函数体跑飞异常问题

async.waterfall ([
function step1(callback) {
epa.EpaSend(buf, function(err,data){ // 异步EPA接收数据1
var test1 = 1;
callback(null,test1);
});
},
function step2(data,callback){
epa.EpaSend(buf, function(err,data){ // 异步EPA接收数据2
var test2 = 2;
cb(null,test2);
});
}
],cb);
使用JS编写后台程序发现异步调用过的函数体内的函数被重复调用。 如上代码:
(1)step1,调用EpaSend读取从设备数据后,执行Step2,执行过程没有问题
(2)Step2调用EpaSend读取从设备数据后,程序会跑到step1函数体内EpaSend接收完成位置“异步EPA接收数据1”然后再跳到“ 异步EPA接收数据2”函数体内,执行逻辑完全错误。
由于EpaSend也是异步调用,按照使用应该没问题,不知道谁遇到过这种pao飞现象?

1个回答

问题解决:
EpaSend里面创建UD定义成全局变量
var epaDgram = require('dgram');
var epaClient = epaDgram.createSocket('udp4');

接收EPA数据后,里面的回调函数cb调用的是“step1”, epaDgram和epaClient改成局部的就可以了,应该是全局变量保持接收状态,但回调函数没更新导致的。
epaClient.on('message', function(msg){
clearTimeout(timeout);
cb(null,msg);
});

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
多进程获得函数返回值问题:get()函数会导致multiprocessing.pool.apply_async 子进程不执行,是什么机理?
想通过使用multiprocessing.pool.apply_async多进程实现一个小功能,在 a[]后不断增加func()的返回值。但是在使用apply_async().get()函数后,子进行并未执行,程序仍然按照顺序执行,运行时间也未减少,约4秒,但是在仅运行apply_async()打印时,程序运行时间几乎是按进程数减少的,约2秒。 如何才能实现多进程获取返回值? 求教各位大神! ``` import time start = time.time() def func(args1): time.sleep(1) print(args1) return (args1 ** 2) from multiprocessing import Pool if __name__ == "__main__": pool = Pool(2) a = [] for i in range(4): a.append(pool.apply_async(func, (i,)).get()) pool.close() pool.join() print(a) end = time.time() print('Running time: %.2f Seconds' % (end - start)) ```
关于线程的问题com.mchange.v2.async.ThreadPoolAsynchrono
![图片说明](https://img-ask.csdn.net/upload/201707/05/1499238606_862427.png) ![图片说明](https://img-ask.csdn.net/upload/201707/05/1499238688_735325.png) 请教这是什么情况,说是线程等待,配置应该有问题,原来也没发现啊,请大神指点 The web application [xx] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThrea d-#1"
TITLE29_ from HOMEPAGE_MESSAGE homepageme0_ where 1=1 and (homepageme0_.DRAFT is null) and (exists (select homepageme1_.id from HOMEPAGE_MESSAGE_RECVER homepage me1_ where homepageme1_.MESSAGE_ID=homepageme0_.id and homepageme1_.STATE=1 and homepageme1_.ISREAD=0 and homepageme1_.RECVER_ID=3240262)) order by homepageme0_ .CRATETIME desc ) where rownum <= ? 得到新消息==={"totalCount":0,"items":[]} Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThrea d-#1" Exception in thread "http-bio-8080-exec-103" Exception in thread "http-bio -8080-exec-70" java.lang.OutOfMemoryError: Java heap space Exception in thread "http-bio-8080-exec-100" java.lang.OutOfMemoryError: Java he ap space Exception in thread "http-bio-8080-exec-76" Hibernate: select count(this_.id) as y0_ from notifications this_ where this_.STATE>? and this_.to_user=?Exception i n thread "http-bio-8080-exec-92" Exception in thread "http-bio-8080-exec-111" Exception in thread "http-bio-8080- exec-109" Exception in thread "http-bio-8080-exec-107" Exception in thread "http -bio-8080-exec-108" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i n thread "http-bio-8080-exec-107" Exception in thread "Thread-4" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i n thread "http-bio-8080-exec-108" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i n thread "Thread-4" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i n thread "http-bio-8080-exec-115" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i n thread "http-bio-8080-exec-88" 600000a=============failedException in thread "http-bio-8080-exec-88" Exception in thread "http-bio-8080-exec-69" at org.apache.tomcat.util.buf.CharChunk.allocate(CharChunk.java:130) at org.apache.tomcat.util.buf.CharChunk.<init>(CharChunk.java:84) 600000a=============failed at org.apache.tomcat.util.http.Parameters.<init> (Parameters.java:233) Exception in thread "http-bio-8080-exec-113" Exception in thread "http-bio-8080- exec-84" 600000a=============success==超时=1544192Exception in thread "http-bio- 8080-Acceptor-0" Exception in thread "Thread-3" 11:03:48.256 WARN org.logicalcobwebs.proxool.spr ing - Suspiciously long active time. #41254 start = Tue Jul 09 10:46:27 CST 2013 Exception in thread "http-bio-8080-exec-94" Exception in thread "http-bio-8080-e xec-99" Exception in thread "http-bio-8080-exec-96" Exception in thread "startQu artz_QuartzSchedulerThread" Exception in thread "http-bio-8080-exec-114" Excepti on in thread "http-bio-8080-exec-116" at org.apache.coyote.Request.<init>(Requ est.java:132) Exception in thread "http-bio-8080-exec-119" at org.apache.coyote.AbstractPro cessor.<init>(AbstractProcessor.java:53) at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp1 1Processor.java:265) at org.apache.coyote.http11.Http11Processor.<init>(Http11Processor.java: 55) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.creat eProcessor(Http11Protocol.java:165)=============================未知 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.creat eProcessor(Http11Protocol.java:103) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process( AbstractProtocol.java:569) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin t.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:603) at java.lang.Thread.run(Thread.java:722) java.lang.OutOfMemoryError: Java heap space 600000a=============failed at java.util.HashMap.clone(HashMap.java:677) at java.util.HashSet.clone(HashSet.java:253) at com.mchange.v2.c3p0.util.ConnectionEventSupport.fireConnectionClosed( ConnectionEventSupport.java:49) at com.mchange.v2.c3p0.impl.NewPooledConnection.fireConnectionClosed(New PooledConnection.java:439) at com.mchange.v2.c3p0.impl.NewPooledConnection.markClosedProxyConnectio n(NewPooledConnection.java:326) at com.mchange.v2.c3p0.impl.NewProxyConnection.close(NewProxyConnection. java:1246) at com.mchange.v1.db.sql.ConnectionUtils.attemptClose(ConnectionUtils.ja va:41) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionRe sourcePoolManager.refurbishResourceOnCheckin(C3P0PooledConnectionPool.java:290) at com.mchange.v2.resourcepool.BasicResourcePool.attemptRefurbishResourc eOnCheckin(BasicResourcePool.java:1606) at com.mchange.v2.resourcepool.BasicResourcePool.access$200(BasicResourc ePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResour ceTask.run(BasicResourcePool.java:1228) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Thre
关于async、await异步的问题
//同步方法 public static int Method(int n) { for (int i = 0; i < 5; i++) { Thread.Sleep(1000); n++; } return n; } //异步方法1[同步方法的异步版本] public static Task<int> MethodAsync(int n) { return Task.Run<int>(() => { return Method(n); }); } //异步方法2[带上了async/await] public static **async** Task<int> MethodAsync(int n) { return **await** Task.Run<int>(() => { return Method(n); }); } 在控制台程序或UI程序的方法异步调用的时候: await MethodAsync(50); await MethodAsync1(50); 都能正常执行,貌似看不出差异啊。 请教高人,这两种方法的表现形式,具体区别在哪里呢???
ios如何等待异步函数执行完成
iOS中如何等待异步函数执行完成之后再进行之后的操作 func getMovies() { let movieId:NSMutableArray = NSMutableArray() let path = "http://v.juhe.cn/movie/movies.today"; let api_id = "42"; let method = "GET"; let param = ["cityid":7,"key":"c086aa6fd871c407219dc969620be8f7", "dtype":"json"]; let juhepai = JHAPISDK.shareJHAPISDK(); let group = dispatch_group_create() dispatch_group_async(group, dispatch_get_main_queue()) { juhepai.executeWorkWithAPI(path, APIID: api_id, parameters: param, method: method, success:{responseObject in /*成功代码*/ let result = responseObject["result"] as! NSArray for i in 0...result.count-1{ let test:NSString = result[i]["movieId"] as! NSString print(test) movieId.addObject(test) } }, failure:{error in /*失败代码*/ print("dsffadf") } ) } dispatch_group_notify(group, dispatch_get_main_queue()) { } } executeWorkWithAPI是聚合数据提供的异步函数,希望在executeWorkWithAPI的回调函数执行完成之后再print(movieId) 试过用diapatch_group,然而每次都是先执行print(movieId)在执行executeWorkWithAPI的回调函数
关于sevlet3.0异步的问题
tomcat初始化时候实例化一个线程池 倘若有两种实现方式 1.请求到达sevlet时候将业务逻辑的thread放到线程池中excute,sevlet正常返回 ``` @WebServlet("/LongRunningServlet") public class LongRunningServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { long startTime = System.currentTimeMillis(); System.out.println("LongRunningServlet Start::Name=" + Thread.currentThread().getName() + "::ID=" + Thread.currentThread().getId()); String time = request.getParameter("time"); int secs = Integer.valueOf(time); // max 10 seconds if (secs > 10000) secs = 10000; ThreadPoolExecutor executor = (ThreadPoolExecutor) request.getServletContext().getAttribute("executor"); executor.execute(new LongRequestProcessor(secs)); PrintWriter out = response.getWriter(); long endTime = System.currentTimeMillis(); out.write("Processing done for " + secs + " milliseconds!!"); System.out.println("LongRunningServlet Start::Name=" + Thread.currentThread().getName() + "::ID=" + Thread.currentThread().getId() + "::Time Taken=" + (endTime - startTime) + " ms."); } private void longProcessing(int secs) { // wait for given time before finishing try { Thread.sleep(secs); } catch (InterruptedException e) { e.printStackTrace(); } } } ``` 线程代码 ``` public class LongRequestProcessor implements Runnable { private int secs; public LongRequestProcessor() { } public LongRequestProcessor(int secs) { this.secs = secs; } @Override public void run() { System.out.println("Async Supported? false "); longProcessing(secs); } private void longProcessing(int secs) { // wait for given time before finishing try { Thread.sleep(secs); System.out.println("sleep suc"); } catch (InterruptedException e) { e.printStackTrace(); } } } ``` 2.使用异步sevlet,在线程传参是传入AsyncContext对象,再放入线程池中excute ``` @WebServlet(urlPatterns = "/AsyncLongRunningServlet", asyncSupported = true) public class AsyncLongRunningServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { long startTime = System.currentTimeMillis(); System.out.println("AsyncLongRunningServlet Start::Name=" + Thread.currentThread().getName() + "::ID=" + Thread.currentThread().getId()); // request.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true); String time = request.getParameter("time"); int secs = Integer.valueOf(time); // max 10 seconds if (secs > 10000) secs = 10000; AsyncContext asyncCtx = request.startAsync(); asyncCtx.addListener(new AppAsyncListener()); asyncCtx.setTimeout(90000); ThreadPoolExecutor executor = (ThreadPoolExecutor) request .getServletContext().getAttribute("executor"); executor.execute(new AsyncRequestProcessor(asyncCtx, secs)); long endTime = System.currentTimeMillis(); System.out.println("AsyncLongRunningServlet End::Name=" + Thread.currentThread().getName() + "::ID=" + Thread.currentThread().getId() + "::Time Taken=" + (endTime - startTime) + " ms."); PrintWriter out = response.getWriter(); out.write("11"); out.flush(); } } ``` 线程代码 ``` public class AsyncRequestProcessor implements Runnable { private AsyncContext asyncContext; private int secs; public AsyncRequestProcessor() { } public AsyncRequestProcessor(AsyncContext asyncCtx, int secs) { this.asyncContext = asyncCtx; this.secs = secs; } @Override public void run() { System.out.println("Async Supported? " + asyncContext.getRequest().isAsyncSupported()); longProcessing(secs); try { PrintWriter out = asyncContext.getResponse().getWriter(); out.write("Processing done for " + secs + " milliseconds!!"); } catch (IOException e) { e.printStackTrace(); } //complete the processing asyncContext.complete(); } private void longProcessing(int secs) { // wait for given time before finishing try { Thread.sleep(secs); } catch (InterruptedException e) { e.printStackTrace(); } } } ``` 据我了解使用异步sevlet是为了达到提高吞吐量的目的,但是就方法1而言,也可以达到将业务线程和容器线程分开的目的,于是我猜测,是不是只有当客户端希望有结果反馈时,这个异步sevlet功能才有其真正的价值
求大佬解答,急!急!急!
com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: 应用程序 DSPWeb_war_20190228 中 servlet action 的某一服务方法创建了未捕获到的异常。创建的异常:java.lang.VerifyError: JVMVRFY012 堆栈形状不一致 类=com/faf/credit/individualcarfinance/action/ArchiveRecordAction,方法=saveUnqualifiedRecord(Lorg/apache/struts/action/ActionMapping;Lorg/apache/struts/action/ActionForm;Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Lorg/apache/struts/action/ActionForward;,pc=40 at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:94) at java.lang.J9VMInternals.initialize(J9VMInternals.java:169) at java.lang.J9VMInternals.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1725) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143) at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:280) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:218) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:416) at javax.servlet.http.HttpServlet.service(HttpServlet.java:718) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131) at com.faf.framework.LoginFilter.doFilter(LoginFilter.java:99) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604) 点击功能时报错信息,求大佬解答下问题出在哪?
The given key was not present in the dictionary
MVC4 开发的后台管理软件,部署到window2003+IIS6.0+SQL2008上。在服务器本地使用内网IP访问,处理表单所有操作正常。但是通过外网IP访问,处理表单出现The given key was not present in the dictionary.问题。跪求高人指点!~ System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at GMS.Web.Admin.Areas.Crm.Controllers.VisitRecordController.Edit(Int32 id, FormCollection collection) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) 注意:
求救!过程或函数 'user_createUser' 需要参数 '@Remark',但未提供该参数。
求救!!! 过程或函数 'user_createUser' 需要参数 '@Remark',但未提供该参数。 说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 过程或函数 'user_createUser' 需要参数 '@Remark',但未提供该参数。 源错误: 执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪: [SqlException (0x80131904): 过程或函数 'user_createUser' 需要参数 '@Remark',但未提供该参数。] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +3279580 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +791 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4927 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +92 System.Data.SqlClient.SqlDataReader.get_MetaData() +102 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +552 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3114 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +554 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +98 System.Data.SqlClient.SqlCommand.ExecuteScalar() +374 Dapper.SqlMapper.ExecuteScalarImpl(IDbConnection cnn, CommandDefinition& command) +311 Dapper.SqlMapper.ExecuteScalar(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) +123 LZ.AgentSqlServerDAL.UserDAL.CreateUser(User user) in E:\勿删\新建文件夹\LZ.AgentSqlServerDAL\UserDAL.cs:27 Web.Controllers.UserController.CreateUser(User user) in E:\勿删\新建文件夹\LZ.AgentWeb\Controllers\UserController.cs:75 lambda_method(Closure , ControllerBase , Object[] ) +139 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +280 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35 System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +33 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +80 System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +386 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +32 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +185 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +59 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +27 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +22 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +22 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
async-http异步框架使用post方法得到的数据怎么返回主界面
async-http异步框架使用post方法,我把这个方法写到了一个服务类的方法中,调用方法之后在onsuccess方法中怎么才能把我连接网络返回的字符串数据传递给我调用这个方法的fargment。
was发布程序,登录后报错,后台日志: SRVE0232E: 内部服务器错误
[16-7-25 22:23:38:260 CST] 00000027 webcontainer E com.ibm.ws.webcontainer.WebContainer handleRequest SRVE0232E: 内部服务器错误。<br>异常消息:[java.lang.StringIndexOutOfBoundsException: String index out of range: 13 at java.lang.String.substring(String.java:1071) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:850) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550) ]
.net core webapi异步接口调用数据库for里面使用await不等待,返回空(有时候有返回值)
使用异步调用一个树结构 ``` public async Task<List<SelectDto>> SelectDeps(int? id) { var results = new List<SelectDto>(); // var deps = db.Department.Where(o=>o.IsDel!=true).Where(o => o.Pid == id || (id == null && o.Pid == 0)).Include(x => x.Children).AsAsyncEnumerable(); // await foreach (var x in deps) // { // var dto = new SelectDto() // { // title = x.DepName, // label = x.DepName, // key = x.Id, // children = await SelectDeps(x.Id) // }; // results.Add(dto); // }; var deps =await db.Department.Where(o=>o.IsDel!=true).Where(o => o.Pid == id || (id == null && o.Pid == 0)).Include(x => x.Children).ToListAsync(); for (int i = 0; i < deps.Count; i++){ var dto = new SelectDto() { title = deps[i].DepName, label = deps[i].DepName, key = deps[i].Id, children = await SelectDeps( deps[i].Id) }; results.Add(dto); }; return results; } ``` 原来无论使用await foreach 或者 for 都会等待执行然后返回数据 直接调用接口没问题。浏览器get方法。 但是前端调用进入调试总是后台返回空值(使用angular)
VS2019未到return就突然函数执行结束
![图片说明](https://img-ask.csdn.net/upload/201912/28/1577510261_313085.png) 构造函数执行到第47行就返回了,断点检测到的,程序没有爆出任何异常。 之前代码都一直是正常执行的,突然一次编译就这样了 而且突然所有的数据绑定和命令绑定都失效了。 有谁遇见过吗? ``` <Page xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="VRnew.View.ManagePatientView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VRnew.View" mc:Ignorable="d" DataContext="{Binding managePatientViewModel, Source={StaticResource Locator}}" x:Name="ManagePatientVMPage" Title="ManagePatientView"> <telerik:RadButton x:Name="FlushButton" Grid.Row="4" Grid.Column="0" Content="刷新" FontSize="25" Command="{Binding DataContext.FlushPatient ,ElementName=ManagePatientVMPage}" telerik:StyleManager.Theme="Office2016Touch" ></telerik:RadButton> ``` 这是View层的 ``` private RelayCommand _flushpatient; public RelayCommand FlushPatient => _flushpatient ?? (_flushpatient = new RelayCommand (async () => { PatientInformationIE = managePatientModel.GetAllPatient(); }) ); ``` 这是VM层的,点击flush按钮没有触发command,断点不执行这里。
utgard在使用异步(Async20Access)读取数据时,总是出错,我的邮箱:sangjingrui@163.com
1. 在使用utgard访问OPC服务器,使用异步(Async20Access)读取数据时,总是出错,同步读取就可以,我想问一下,这是什么问题? 下面是console输出:Recieved FAULT 最后接到一个FAULT,不知道什么原因,请赐教! 2. 代码: public static void main ( final String[] args ) throws Throwable { // create connection information final ConnectionInformation ci = new ConnectionInformation (); ci.setHost("127.0.0.1"); // 电脑IP ci.setDomain(""); // 域,为空就行 ci.setUser("opcuser"); // 电脑上自己建好的用户名 ci.setPassword("123456"); //密码 // 使用KEPServer的配置 ci.setClsid("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"); final Set<String> items = new HashSet<String> (); if ( items.isEmpty () ) { items.add ("ch1.d1.tag1"); items.add ("ch1.d1.tag2"); } // create a new server final Server server = new Server ( ci, Executors.newSingleThreadScheduledExecutor () ); try { // connect to server server.connect (); // add sync access final AccessBase access = new Async20Access ( server, 100, false ); for ( final String itemId : items ) { access.addItem ( itemId, new DataCallbackDumper () ); } // start reading access.bind (); // wait a little bit _log.info ( "Sleep for some seconds to give events a chance..." ); Thread.sleep ( 10 * 1000 ); _log.info ( "Returned from sleep" ); // stop reading access.unbind (); } catch ( final JIException e ) { System.out.println ( String.format ( "%08X: %s", e.getErrorCode (), server.getErrorMessage ( e.getErrorCode () ) ) ); } } } 3. 我发现同样的代码,采用同步读取就没有问题,这是为什么?是不是对异步需要对环境进一步配置? 我的邮箱:sangjingrui@163.com
tomcat启动报错问题,求大神帮忙
Managed Threads: 3 Active Threads: 3 Active Tasks: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@189b939 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@df824a (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1e2c9bf (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0) Pending Tasks: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@2b2af3 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@10e9df com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6a2f81 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@154ea79 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1edd9b3 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6f947b com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@17d2f0e Pool thread stack traces: Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main] java.lang.Thread.sleep(Native Method) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main] java.lang.Thread.sleep(Native Method) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main] java.lang.Thread.sleep(Native Method) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) >
spring task定时器为什么执行一段时间报错,什么原因,怎么解决?
spring task 定时器执行一段时间就打印下面的错误日志,这个是什么问题,什么原因造成的,怎么解决?? ``` 2019-11-05 09:42:07,090 WARN async.ThreadPoolAsynchronousRunner (ThreadPoolAsynchronousRunner.java:run:791) -com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7c495b6f -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! 2019-11-05 09:42:07,111 WARN async.ThreadPoolAsynchronousRunner (ThreadPoolAsynchronousRunner.java:run:807) -com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7c495b6f -- APPARENT DEADLOCK!!! Complete Status: Managed Threads: 3 Active Threads: 3 Active Tasks: com.mchange.v2.c3p0.stmt.GooGooStatementCache$StatementDestructionManager$1UncheckedStatementCloseTask@67e99ca4 on thread: C3P0PooledConnectionPoolManager[identityToken->nb1w5dukzphi1cl6wf9|73d0af5e]-HelperThread-#2 com.mchange.v2.c3p0.stmt.GooGooStatementCache$StatementDestructionManager$1UncheckedStatementCloseTask@5f28f056 on thread: C3P0PooledConnectionPoolManager[identityToken->nb1w5dukzphi1cl6wf9|73d0af5e]-HelperThread-#1 com.mchange.v2.c3p0.stmt.GooGooStatementCache$StatementDestructionManager$1UncheckedStatementCloseTask@1d6d7b6b on thread: C3P0PooledConnectionPoolManager[identityToken->nb1w5dukzphi1cl6wf9|73d0af5e]-HelperThread-#0 Pending Tasks: com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@7b9e8845 com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@5039372e com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@480bc73f com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@3e4b5b76 com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@3118305a com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@2881f110 com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@3ea5f900 com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@5ad18549 com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@2abbe4a9 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@d95999f com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@1ce90cd4 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@4a4439cd com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@3f2f0280 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@1ed72d9b com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@4a0c0d39 Pool thread stack traces: Thread[C3P0PooledConnectionPoolManager[identityToken->nb1w5dukzphi1cl6wf9|73d0af5e]-HelperThread-#2,5,main] oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1343) oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:100) oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:82) com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:53) com.mchange.v2.c3p0.stmt.GooGooStatementCache$StatementDestructionManager$1UncheckedStatementCloseTask.run(GooGooStatementCache.java:934) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) Thread[C3P0PooledConnectionPoolManager[identityToken->nb1w5dukzphi1cl6wf9|73d0af5e]-HelperThread-#1,5,main] oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1343) oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:100) oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:82) com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:53) com.mchange.v2.c3p0.stmt.GooGooStatementCache$StatementDestructionManager$1UncheckedStatementCloseTask.run(GooGooStatementCache.java:934) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) Thread[C3P0PooledConnectionPoolManager[identityToken->nb1w5dukzphi1cl6wf9|73d0af5e]-HelperThread-#0,5,main] oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1343) oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:100) oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:82) com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:53) com.mchange.v2.c3p0.stmt.GooGooStatementCache$StatementDestructionManager$1UncheckedStatementCloseTask.run(GooGooStatementCache.java:934) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) ```
System.ArgumentNullException: 值不能为 null
行 47: </script> 行 48: } 行 49: @(X.Viewport() 行 50: .Layout(LayoutType.Border) 行 51: .Items( [ArgumentNullException: 值不能为 null。 参数名: source] System.Linq.Enumerable.Select(IEnumerable`1 source, Func`2 selector) +4091099 ASP._Page_Areas_Facilities_Views_EquipmentPurchasingApplication_Index_cshtml.Execute() in f:\万通(备份)\tfs\湘粮 - 数字粮食管理平台\04 源码库\02 中心版\Wantn.DigitalGranary.Client.Web\Areas\Facilities\Views\EquipmentPurchasingApplication\Index.cshtml:49 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +103 System.Web.WebPages.StartPage.RunPage() +17 System.Web.WebPages.StartPage.ExecutePageHierarchy() +62 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +254 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +290 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +22 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +176 System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +75 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9659272 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
c3p0异常求解
[code="java"] com.mchange.v2.async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@16597ba APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! com.mchange.v2.async.ThreadPoolAsynchronousRunner -163073277 [Timer-0] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@16597ba APPARENT DEADLOCK!!! Complete Status: [num_managed_threads: 10, num_active: 10; activeTasks: com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@a1f903 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@1e35936 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#8), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@f5e931 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#7), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@a0cbf4 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@ae1f44 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@186daf2 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@906a8d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@1438396 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@173f6bb (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@4b8a67 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5); pendingTasks: com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@16b9960, com.mchange.v2.resourcepool.BasicResourcePool$6@1227588, com.mchange.v2.resourcepool.BasicResourcePool$6@152658a, com.mchange.v2.resourcepool.BasicResourcePool$6@885610, com.mchange.v2.resourcepool.BasicResourcePool$6@ca3add, com.mchange.v2.resourcepool.BasicResourcePool$6@dea987, com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4beff3, com.mchange.v2.resourcepool.BasicResourcePool$6@1765f99, com.mchange.v2.resourcepool.BasicResourcePool$6@7e7001] [/code] [code="java"] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner - Task com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@f5e931 (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt(). [/code] 中午重启后运行正常,隔天访问就会这样,求解。。。 附上配置 [code="java"] c3p0.acquireIncrement=3 c3p0.initialPoolSize=3 c3p0.idleConnectionTestPeriod=1800 c3p0.minPoolSize=1 c3p0.maxPoolSize=10 c3p0.maxStatements=100 c3p0.numHelperThreads=10 c3p0.maxIdleTime=600 c3p0.automaticTestTable=C3P0TestTable [/code] 框架用的是SSI
.net 赋值实体的某个值为异步时候有时候不等待
```csharp // 异步方法 public async Task<List<SelectDto>> SelectMenus(int? id) { var results = new List<SelectDto>(); //var menus = await db.Menu.Where(o => o.Pid == id).Include(x => x.Children).ToListAsync(); //for (int i = 0; i < menus.Count; i++) //{ // var dto = new SelectDto() // { // title = menus[i].Text, // label = menus[i].Text, // key = menus[i].Id, // children = await SelectMenus(menus[i].Id) // }; // results.Add(dto); //} var menus = db.Menu.Where(o => o.Pid == id).Include(x => x.Children).AsAsyncEnumerable(); // forEach 只支持同步代码,c#8.0后引入了await foreach; await foreach (var x in menus) { var dto = new SelectDto() { title = x.Text, label = x.Text, key = x.Id, children = await SelectMenus(x.Id) }; results.Add(dto); }; return results; } //调用api [HttpGet("SelectMenu")] public async Task<ResponseDto> SelectMenu() { result.data = await bll.SelectMenus(null); return result; } ``` 调用的时候如果先用`var x=await bll.SelectMenus(null); result.data=x;`这样能取到值,但是如果直接赋值有时候取不到值
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
前端 | 2. 正则
转载请注明以下: 本文转自清自以敬的博客:https://blog.csdn.net/qq_45791147 文章目录1.转义2.正则表达式初步2.1.匹配字符2.1.1.组成元素2.1.2.基础正则的设计 1.转义 转义的作用: 当某个字符在表达式中具有特殊含义,例如字符串引号中出现了引号,为了可以使用这些字符本身,而不是使用其在表达式中的特殊含义,则需要通过转义符“\”来构建该字符转义...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
Docker 从入门到掉坑
Docker 介绍 简单的对docker进行介绍,可以把它理解为一个应用程序执行的容器。但是docker本身和虚拟机还是有较为明显的出入的。我大致归纳了一下,可以总结为以下几点: docker自身也有着很多的优点,关于它的优点,可以总结为以下几项: 安装docker 从 2017 年 3 月开始 docker 在原来的基础上分为两个分支版本: Docker CE 和 Doc...
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
相关热词 c# 二进制截断字符串 c#实现窗体设计器 c#检测是否为微信 c# plc s1200 c#里氏转换原则 c# 主界面 c# do loop c#存为组套 模板 c# 停掉协程 c# rgb 读取图片
立即提问

相似问题

1
spring async 队列疑问
0
websphere报错“WSVR0605W”,生成javacore文件
2
运行Java程序时报错Error:(3001, 19) java: ncCommonSvc.AsyncClient.microprobe_call不是抽象的
4
Could not load driverClass com.mysql.jbdc.Driver,配置好jar了还是找不到
1
@Async 异步失效。。。。。。。。。。。。。
1
将HEXO部署到Github中出现问题
1
java Vxipmi Command timed out
1
异步调用,返回的结果要怎么处理
1
微信小程序访问mysql的云函数
1
关于spring async 灵活配置的问题
0
Nuxt.js 在动态路由_id.vue里使用asyncData,为什么会执行2次?
1
spring task定时器为什么执行一段时间报错,什么原因,怎么解决?
2
ajax嵌套ajax,取不出外层的值
1
报错aiohttp.client_exceptions.ClientProxyConnectionError: Cannot connect to host 117.57.90.155:9999 ssl:default [Connect call failed ('117.57.90.155', 9999)]
1
utgard在使用异步(Async20Access)读取数据时,总是出错,我的邮箱:sangjingrui@163.com
1
eclipse中springboot在类中使用@Transactional和@Async后,打断点进行debug就会提示missing line number?
1
Flink local模式下,运行Flink自带的jar包一直报错
1
vue中引入了axios 配置了axios.defaults.baseUrl,但是启动访问接口的时候直接是访问成vue默认的端口怎么解决
1
JAVA导出Excel时,可以正常导出,但是后端控制台报错JsonMappingException
1
利用flask+celery+flask_mail扩展异步发送邮件时,celery会出现上下文问题,有人能解决吗?网上找了很多,都感觉很模糊