1. 程式人生 > >LoadRunner 常見錯誤收集及解決方案

LoadRunner 常見錯誤收集及解決方案

上一個 exc nic win iss 溢出 red sage sed

一. This Vuser already started a transaction with the same name, and has not yet processed the corresponding lr_end_transaction statement.   在做性能測試的時候,有時候會遇到下面的錯誤:This Vuser already started a transaction with the same name, and has not yet processed the corresponding lr_end_transaction statement.   解釋:就是腳本中有一個事物開始了,但是沒有結束事物,此時loadrunner就會報錯,因為開始和結束是一一對應的,誰也不能把它們拆開,拆開了就會報錯。   異常再現:   下列代碼中,如果業務方法報了異常(Throw Exception),那麽下面的if判斷的代碼不會被執行,而直接跳到catch子句裏,那麽已經開始的業務"searchItemList_man"就沒有被結束,當你再次開始業務時,就會報錯~
1 public int action() throws Throwable { 2 3 misc = generateManItemSearchCondition(); 4 lr.start_transaction("searchItemList_man"); 5 try { 6 //業務方法 7 items = searchService.searchItemList(misc); 8 if (items.isSuccess()) { 9 lr.end_transaction("searchItemList_man",lr.PASS); 10 11 } else { 12 lr.end_transaction("searchItemList_man",lr.FAIL); 13 } 14 orderMap.clear(); 15 productIdSet.clear(); 16 productStatusList.clear(); 17 } catch (Exception e) { 18 19 20 e.printStackTrace(); 21 } 22 23 24 misc = null; 25 items = null; 26 return 0; 27 }//end of action
  解決辦法: 在catch字句裏加上一個 事務結束代碼,修改後的catch段代碼如下:
catch (Exception e) { // TODO Auto-generated catch block lr.end_transaction("searchItemList_man",lr.FAIL); e.printStackTrace(); }
 二.Function two_way_comm_post_message / two_way_comm_post_message_ex failed錯誤 技術分享圖片   在Controller裏運行腳本,運行一段時間以後出現如下error messages。   1. Code - 60990 Error: Two Way Communication Error: Function two_way_comm_post_message / two_way_comm_post_message_ex failed.   2. Code - 29739 Error: Service client with id=1 failed to post a message, reason - communication error.   3. Code - 16895 Error: Failed to post xdr buffers data array by post_ex.   4. Code - 10343 Error: Communication error: Cannot send the message since reached the shared memory buffer max size.   問題誘因1:   共享內存緩存溢出,造成Controller和Load Generator之間通訊出現問題。   解決方案:   修改兩個配置文件。   1. $installation folder$\dat\channel_configure.dat   2. $installation folder$\launch_service\dat\channel_configure.dat   在這兩個文件中的[general]部分下添加如下配置。   shared_memory_max_size=100 (修改共享內存為100MB,默認是50MB)   重新啟動Controller,問題解決。   問題誘因2   打開 controller中的 diagnostics菜單,點掉復選框.. 步驟如下圖   1. 技術分享圖片
  2. 點掉 Enable the following diagnostics 技術分享圖片   3. 整理了一下 這個功能是幹麽滴:   當場景中打開 Diagnostics 菜單下 Web Page Diagnostics 功能後, 才能得到網頁分析組圖。   通過該圖, 可以對事務的組成進行抽絲剝繭的分析, 得到組成這個頁面的每一個請求的時間分析, 進 一步了解響應時間中有關網絡和服務器處理時間的分配關系。   可以實現對網站的前端性能分析, 明確系統響應時間較長是由服務器端處理能力不足還是客戶端鏈接 到服務器的網絡消耗導致的。   三. Fatal Error -26000: Not enough memory (12320 bytes) for "new buffer in LrwSrvNetTaskIt 問題解決及lr腳本心得   現象: 用loadrunner跑場景的時候報錯:   Action.c(28): Fatal Error -26000: Not enough memory (12320 bytes) for "new buffer in LrwSrvNetTaskItem::AllocSrvNetBuf". Aborting 的錯誤,   同時任務管理器裏mmdrv.exe 內存占用一直增大,最終mmdrv.exe崩潰. 網上有人認為是 lr的 emulation browser設置問題,最後發現系腳本問題,原腳本聲明了好幾個變量,而且都未使用:
1 Action() 2 { 3 4 //返回的字符串 5 char resp_txt[200] = {0}; 6 //寫入流的數據 7 long myfile; 8 //當前日期時間 9 long now; 10 ..... 11 ...... 12 13 return 0; 14 }
  解決方法及總結:   後將此三個變量註釋之後問題解決.   結論:LR的腳本要註意內存的使用,盡量減少變量聲明,對於char類型的變量要及時用free:即:   1 char * a;   2 free (a);

LoadRunner 常見錯誤收集及解決方案