mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
[378136][dstore] miner.finish is stuck
This commit is contained in:
parent
59af7334ff
commit
3d5e188f9b
6 changed files with 111 additions and 86 deletions
|
@ -21,6 +21,7 @@
|
|||
* David McKnight (IBM) - [328060] [dstore] command queue in Miner should be synchronized
|
||||
* David McKnight (IBM) - [358301] [DSTORE] Hang during debug source look up
|
||||
* David McKnight (IBM) - [373507] [dstore][multithread] reduce heap memory on disconnect for server
|
||||
* David McKnight (IBM) - [378136] [dstore] miner.finish is stuck
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.core.miners;
|
||||
|
@ -130,19 +131,21 @@ implements ISchemaExtender
|
|||
*/
|
||||
public void finish()
|
||||
{
|
||||
if (_dataStore.getClient() != null) {
|
||||
_dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "Miner.finish()"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
synchronized (_commandQueue){
|
||||
_commandQueue.clear();
|
||||
}
|
||||
DataElement root = _dataStore.getMinerRoot();
|
||||
_minerData.removeNestedData();
|
||||
_minerElement.removeNestedData();
|
||||
_dataStore.update(_minerElement);
|
||||
|
||||
if (root != null && root.getNestedData() != null){
|
||||
root.getNestedData().remove(_minerElement);
|
||||
root.setExpanded(false);
|
||||
root.setUpdated(false);
|
||||
_dataStore.update(root);
|
||||
}
|
||||
super.finish();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
* David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support
|
||||
* David McKnight (IBM) - [368072] [dstore][ssl] no exception logged upon bind error
|
||||
* David McKnight (IBM) - [371401] [dstore][multithread] avoid use of static variables - causes memory leak after disconnect
|
||||
* David McKnight (IBM) - [378136] [dstore] miner.finish is stuck
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.core.server;
|
||||
|
@ -214,7 +215,10 @@ public class ConnectionEstablisher
|
|||
* Tells the connection establisher to clean up and shutdown
|
||||
*/
|
||||
public void finished(ServerReceiver receiver)
|
||||
{
|
||||
{
|
||||
if (_dataStore.getClient() != null) {
|
||||
_dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "ConnectionEstablisher.finished()"); //$NON-NLS-1$
|
||||
}
|
||||
_updateHandler.removeSenderWith(receiver.socket());
|
||||
_receivers.remove(receiver);
|
||||
_dataStore.removeDataStorePreferenceListener(receiver);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -19,6 +19,7 @@
|
|||
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
|
||||
* Noriaki Takatsu (IBM) - [289234][multithread][api] Reset and Restart KeepAliveRequestThread
|
||||
* David McKnight (IBM) - [282364] [dstore][multithread] timer-threads stay active after disconnect
|
||||
* David McKnight (IBM) - [378136] [dstore] miner.finish is stuck
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.core.util;
|
||||
|
@ -166,7 +167,7 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
|||
{
|
||||
// something really bad happened
|
||||
_canExit = true;
|
||||
if (_xmlParser.getPanicException() != null)
|
||||
if (_xmlParser.getPanicException() != null && (_dataStore != null && _dataStore.isConnected()))
|
||||
handleError(_xmlParser.getPanicException());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* David McKnight (IBM) - [282364] [dstore][multithread] timer-threads stay active after disconnect
|
||||
* David McKnight (IBM) - [371401] [dstore][multithread] avoid use of static variables - causes memory leak after disconnect
|
||||
* David McKnight (IBM) - [373459] [dstore][multithread] duplicate finish() calls during idle timeout
|
||||
* David McKnight (IBM) - [378136] [dstore] miner.finish is stuck
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.internal.core.server;
|
||||
|
@ -52,6 +53,7 @@ public class ServerCommandHandler extends CommandHandler
|
|||
{
|
||||
private long _timeout;
|
||||
private boolean _serverTimedOut = false;
|
||||
private boolean _serverDone = false;
|
||||
|
||||
public ServerIdleThread(long timeout)
|
||||
{
|
||||
|
@ -60,7 +62,7 @@ public class ServerCommandHandler extends CommandHandler
|
|||
|
||||
public void run()
|
||||
{
|
||||
while (!_serverTimedOut)
|
||||
while (!_serverTimedOut && !_serverDone)
|
||||
{
|
||||
if (_dataStore.getClient() != null) {
|
||||
_dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "ServerIdleThread.waitForTimeout()..."); //$NON-NLS-1$
|
||||
|
@ -86,6 +88,12 @@ public class ServerCommandHandler extends CommandHandler
|
|||
_dataStore.getClient().disconnectServerReceiver();
|
||||
}
|
||||
}
|
||||
else if (_serverDone){
|
||||
if (_dataStore.getClient() != null) {
|
||||
_dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "Server complete so existing server idle thread"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected synchronized void waitForTimeout()
|
||||
|
@ -217,7 +225,7 @@ public class ServerCommandHandler extends CommandHandler
|
|||
}
|
||||
|
||||
if (_serverIdleThread.isAlive()){
|
||||
_serverIdleThread._serverTimedOut = true;
|
||||
_serverIdleThread._serverDone = true;
|
||||
_serverIdleThread.interrupt();
|
||||
}
|
||||
_serverIdleThread = null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -14,6 +14,7 @@
|
|||
* Contributors:
|
||||
* David McKnight (IBM) - [232233] [dstore] Buffer in DataElement is not retained
|
||||
* David McKnight (IBM) - [245481] [dstore] CR/LF not restored for new client/old server
|
||||
* David McKnight (IBM) - [378136] [dstore] miner.finish is stuck
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.internal.core.util;
|
||||
|
@ -81,7 +82,7 @@ public class XMLgenerator
|
|||
{
|
||||
_dataStore = dataStore;
|
||||
_state = EMPTY;
|
||||
_bufferSize = 100000;
|
||||
_bufferSize = 200000; // doubled this since it was a little on the small end before
|
||||
|
||||
_document = new StringBuffer(_bufferSize);
|
||||
|
||||
|
@ -159,7 +160,7 @@ public class XMLgenerator
|
|||
_document.append('\n');
|
||||
|
||||
int length = _document.length();
|
||||
if (length > _bufferSize)
|
||||
if (length +1000 > _bufferSize)
|
||||
{
|
||||
flushData();
|
||||
}
|
||||
|
@ -519,32 +520,34 @@ public class XMLgenerator
|
|||
*/
|
||||
public synchronized void generate(DataElement object, byte[] bytes, int size, boolean isAppend, boolean binary)
|
||||
{
|
||||
String tagType = XMLparser.STR_FILE;
|
||||
if (isAppend)
|
||||
{
|
||||
tagType += ".Append"; //$NON-NLS-1$
|
||||
}
|
||||
if (binary)
|
||||
{
|
||||
tagType += ".Binary"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (object != null)
|
||||
{
|
||||
startTag(tagType);
|
||||
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
|
||||
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
|
||||
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
|
||||
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
|
||||
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
|
||||
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
|
||||
|
||||
addReferenceTypeAttribute(object);
|
||||
|
||||
addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$
|
||||
addFile(bytes, size, binary);
|
||||
|
||||
endTag(tagType);
|
||||
if (_dataStore != null && (_dataStore.isVirtual() || _dataStore.isConnected())){
|
||||
String tagType = XMLparser.STR_FILE;
|
||||
if (isAppend)
|
||||
{
|
||||
tagType += ".Append"; //$NON-NLS-1$
|
||||
}
|
||||
if (binary)
|
||||
{
|
||||
tagType += ".Binary"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (object != null)
|
||||
{
|
||||
startTag(tagType);
|
||||
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
|
||||
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
|
||||
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
|
||||
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
|
||||
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
|
||||
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
|
||||
|
||||
addReferenceTypeAttribute(object);
|
||||
|
||||
addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$
|
||||
addFile(bytes, size, binary);
|
||||
|
||||
endTag(tagType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -557,24 +560,27 @@ public class XMLgenerator
|
|||
*/
|
||||
public synchronized void generate(DataElement object, byte[] bytes, int size)
|
||||
{
|
||||
String tagType = XMLparser.STR_CLASS;
|
||||
if (_dataStore != null && (_dataStore.isVirtual() || _dataStore.isConnected())){
|
||||
|
||||
if (object != null)
|
||||
{
|
||||
startTag(tagType);
|
||||
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
|
||||
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
|
||||
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
|
||||
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
|
||||
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
|
||||
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
|
||||
String tagType = XMLparser.STR_CLASS;
|
||||
|
||||
addReferenceTypeAttribute(object);
|
||||
if (object != null)
|
||||
{
|
||||
startTag(tagType);
|
||||
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
|
||||
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
|
||||
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
|
||||
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
|
||||
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
|
||||
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
|
||||
|
||||
addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$
|
||||
addFile(bytes, size, true);
|
||||
addReferenceTypeAttribute(object);
|
||||
|
||||
endTag(tagType);
|
||||
addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$
|
||||
addFile(bytes, size, true);
|
||||
|
||||
endTag(tagType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -586,46 +592,48 @@ public class XMLgenerator
|
|||
*/
|
||||
public void generate(DataElement object, int depth)
|
||||
{
|
||||
if ((object != null) && (depth >= 0))
|
||||
{
|
||||
String tagType = XMLparser.STR_DATAELEMENT;
|
||||
|
||||
if (object.isUpdated() && !object.isPendingTransfer())
|
||||
if (_dataStore != null && (_dataStore.isVirtual() || _dataStore.isConnected())){
|
||||
if ((object != null) && (depth >= 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (object.isDeleted() && _ignoreDeleted)
|
||||
String tagType = XMLparser.STR_DATAELEMENT;
|
||||
|
||||
if (object.isUpdated() && !object.isPendingTransfer())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
object.setPendingTransfer(false);
|
||||
|
||||
startTag(tagType);
|
||||
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
|
||||
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
|
||||
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
|
||||
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
|
||||
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
|
||||
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
|
||||
|
||||
addReferenceTypeAttribute(object);
|
||||
|
||||
addAttribute(DE.P_DEPTH, "" + object.depth()); //$NON-NLS-1$
|
||||
addData(object.getBuffer());
|
||||
object.setUpdated(true);
|
||||
|
||||
if (!object.isReference() && depth >= 0)
|
||||
if (object.isDeleted() && _ignoreDeleted)
|
||||
{
|
||||
for (int i = 0; i < object.getNestedSize(); i++)
|
||||
{
|
||||
generate(object.get(i), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// end generation
|
||||
endTag(tagType);
|
||||
else
|
||||
{
|
||||
object.setPendingTransfer(false);
|
||||
|
||||
startTag(tagType);
|
||||
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
|
||||
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
|
||||
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
|
||||
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
|
||||
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
|
||||
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
|
||||
|
||||
addReferenceTypeAttribute(object);
|
||||
|
||||
addAttribute(DE.P_DEPTH, "" + object.depth()); //$NON-NLS-1$
|
||||
addData(object.getBuffer());
|
||||
object.setUpdated(true);
|
||||
|
||||
if (!object.isReference() && depth >= 0)
|
||||
{
|
||||
for (int i = 0; i < object.getNestedSize(); i++)
|
||||
{
|
||||
generate(object.get(i), depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// end generation
|
||||
endTag(tagType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -26,6 +26,7 @@
|
|||
* David McKnight (IBM) [350315][dstore] regress change made for bug 305218
|
||||
* David McKnight (IBM) - [358301] [DSTORE] Hang during debug source look up
|
||||
* David McKnight (IBM) - [367449] [dstore] allow custom encoding for data transport layer
|
||||
* David McKnight (IBM) - [378136][dstore] miner.finish is stuck
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.internal.core.util;
|
||||
|
@ -563,8 +564,8 @@ public class XMLparser
|
|||
|
||||
boolean done = false;
|
||||
try {
|
||||
while (!done)
|
||||
{
|
||||
while (!done && (_dataStore != null && _dataStore.isConnected()))
|
||||
{
|
||||
String xmlTag = readLine(reader, socket);
|
||||
|
||||
if (xmlTag != null)
|
||||
|
|
Loading…
Add table
Reference in a new issue