有沒有誰碰到Weblogic應用伺服器叢集將客戶端的一個請求併發為兩個請求來同時進行處理?絕對實踐中的真實問題

dctor發表於2004-12-23
本人現在公司用Java進行電子繳款系統模組的開發,
使用的是無狀態SessionBean,
應用伺服器為Weblogic配置的一個叢集,
偶爾出現過1-2次併發操作(併發程度在1秒以內);
簡單的說,我從前臺發起一個扣款請求,從程式流程和EJB的架構來說,後臺也應該發起一筆扣款請求;
問題就在於後臺不只發起一起扣款請求,而是幾乎同時發起兩筆扣款請求,從而導致併發重複扣款;

暫時還沒有找到具體產生原因,初步分析原因有兩個
1)伺服器叢集演算法出現Bug,導致同時有兩個Bean在伺服器中運作;
2)前臺的事件處理存在Bug,同時發起了兩個請求,只是介面上看不出來而已;

我的同事上次就這個問題發過問題,那是2個月前出現的一批併發重扣;
我今天再次發出此貼,就是因為前幾天我又發現了一批併發重扣;

我們再上一次的教訓上,這次多輸出了一些除錯資訊,主要是Weblogic的事務資訊如下:
連續兩個我認為併發的Bean輸出的日誌如下(但是我不清楚這些日誌代表什麼意思):

2004-12-14 11:29:50,402 [system:124] [ExecuteThread: '8' for queue: 'weblogic.kernel.Default'] - ZScomm ZSetskkService.logTx jklsh = 3200412052036014
**********
txid1 = BEA1-72E10BBC0AA811840C29
**********
txid2 = BEA1-72E10BBC0AA811840C29
**********
TxStatus1 = Active
**********
TxStatus2 = Active
**********
timeSinceBegin1 = 645
**********
timeSinceBegin2 = 645
**********
tx1 = Name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)],Xid=BEA1-72E10BBC0AA811840C29(17975654),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=599,activeThread=Thread[ExecuteThread: '8' for queue: 'weblogic.kernel.Default',5,Thread Group for Queue: 'weblogic.kernel.Default'],XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=ended,assigned=none),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@190cb2a),SCInfo[coredomain+coreapp4]=(state=active),SCInfo[eaidomain+eaiserver]=(state=active),properties=({weblogic.transaction.name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)], weblogic.jdbc=t3://150.18.30.31:7013}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+, XAResources={},NonXAResources={})],CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+)
**********
tx2 = Name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)],Xid=BEA1-72E10BBC0AA811840C29(17975654),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=599,activeThread=Thread[ExecuteThread: '8' for queue: 'weblogic.kernel.Default',5,Thread Group for Queue: 'weblogic.kernel.Default'],XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=ended,assigned=none),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@190cb2a),SCInfo[coredomain+coreapp4]=(state=active),SCInfo[eaidomain+eaiserver]=(state=active),properties=({weblogic.transaction.name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)], weblogic.jdbc=t3://150.18.30.31:7013}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+, XAResources={},NonXAResources={})],CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+)

========================================================================================

2004-12-14 11:29:50,993 [system:124] [ExecuteThread: '20' for queue: 'weblogic.kernel.Default'] - ZScomm ZSetskkService.logTx jklsh = 3200412052036016
**********
txid1 = BEA1-72E50BBC0AA811840C29
**********
txid2 = BEA1-72E50BBC0AA811840C29
**********
TxStatus1 = Active
**********
TxStatus2 = Active
**********
timeSinceBegin1 = 763
**********
timeSinceBegin2 = 763
**********
tx1 = Name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)],Xid=BEA1-72E50BBC0AA811840C29(18172396),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=600,activeThread=Thread[ExecuteThread: '20' for queue: 'weblogic.kernel.Default',5,Thread Group for Queue: 'weblogic.kernel.Default'],XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=ended,assigned=none),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@a82896),SCInfo[coredomain+coreapp4]=(state=active),SCInfo[eaidomain+eaiserver]=(state=active),properties=({weblogic.transaction.name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)], weblogic.jdbc=t3://150.18.30.31:7013}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+, XAResources={},NonXAResources={})],CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+)
**********
tx2 = Name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)],Xid=BEA1-72E50BBC0AA811840C29(18172396),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=600,activeThread=Thread[ExecuteThread: '20' for queue: 'weblogic.kernel.Default',5,Thread Group for Queue: 'weblogic.kernel.Default'],XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=ended,assigned=none),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@a82896),SCInfo[coredomain+coreapp4]=(state=active),SCInfo[eaidomain+eaiserver]=(state=active),properties=({weblogic.transaction.name=[EJB gov.gdlt.taxcore.gateway.facade.TaxFacadeGateWayBean.invokeTask(gov.gdlt.taxcore.comm.event.RequestEvent)], weblogic.jdbc=t3://150.18.30.31:7013}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+, XAResources={},NonXAResources={})],CoordinatorURL=coreapp4+150.18.30.31:7013+coredomain+t3+)

=======================
=======輸出以上日誌資訊所用到的方法如下=================
weblogic.transaction.Transaction t1 = weblogic.transaction.TxHelper.
getTransaction();
String txid1 = "" + t1.getXid();
String txStatus1 = "" + t1.getStatusAsString();
long timeSinceBegin1 = t1.getMillisSinceBegin();

weblogic.transaction.Transaction t2 = ((weblogic.transaction.
Transaction) weblogic.transaction.TransactionHelper.
getTransactionHelper().getTransaction());
String txid2 = "" + t2.getXid();
String txStatus2 = "" + t2.getStatusAsString();
long timeSinceBegin2 = t2.getMillisSinceBegin();

LogWritter.sysError("ZScomm ZSetskkService.logTx jklsh = " + jklsh +
" \r\n**********\r\n txid1 = " + txid1 +
" \r\n**********\r\n txid2 = " + txid2 +
" \r\n**********\r\n TxStatus1 = " + txStatus1 +
" \r\n**********\r\n TxStatus2 = " + txStatus2 +
" \r\n**********\r\n timeSinceBegin1 = " +
timeSinceBegin1 +
" \r\n**********\r\n timeSinceBegin2 = " +
timeSinceBegin2 +
" \r\n**********\r\n tx1 = " + t1.toString() +
" \r\n**********\r\n tx2 = " + t2.toString());

相關文章