1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-17 22:15:23 +02:00

[378136][dstore] miner.finish is stuck

This commit is contained in:
David McKnight 2012-05-01 16:01:59 +00:00
parent 59af7334ff
commit 3d5e188f9b
6 changed files with 111 additions and 86 deletions

View file

@ -21,6 +21,7 @@
* David McKnight (IBM) - [328060] [dstore] command queue in Miner should be synchronized * 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) - [358301] [DSTORE] Hang during debug source look up
* David McKnight (IBM) - [373507] [dstore][multithread] reduce heap memory on disconnect for server * 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; package org.eclipse.dstore.core.miners;
@ -130,19 +131,21 @@ implements ISchemaExtender
*/ */
public void finish() public void finish()
{ {
if (_dataStore.getClient() != null) {
_dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "Miner.finish()"); //$NON-NLS-1$
}
synchronized (_commandQueue){ synchronized (_commandQueue){
_commandQueue.clear(); _commandQueue.clear();
} }
DataElement root = _dataStore.getMinerRoot(); DataElement root = _dataStore.getMinerRoot();
_minerData.removeNestedData(); _minerData.removeNestedData();
_minerElement.removeNestedData(); _minerElement.removeNestedData();
_dataStore.update(_minerElement);
if (root != null && root.getNestedData() != null){ if (root != null && root.getNestedData() != null){
root.getNestedData().remove(_minerElement); root.getNestedData().remove(_minerElement);
root.setExpanded(false); root.setExpanded(false);
root.setUpdated(false); root.setUpdated(false);
_dataStore.update(root);
} }
super.finish(); super.finish();
} }

View file

@ -28,6 +28,7 @@
* David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support * 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) - [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) - [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; package org.eclipse.dstore.core.server;
@ -214,7 +215,10 @@ public class ConnectionEstablisher
* Tells the connection establisher to clean up and shutdown * Tells the connection establisher to clean up and shutdown
*/ */
public void finished(ServerReceiver receiver) 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()); _updateHandler.removeSenderWith(receiver.socket());
_receivers.remove(receiver); _receivers.remove(receiver);
_dataStore.removeDataStorePreferenceListener(receiver); _dataStore.removeDataStorePreferenceListener(receiver);

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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 * 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 * 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) - [282364] [dstore][multithread] timer-threads stay active after disconnect
* David McKnight (IBM) - [378136] [dstore] miner.finish is stuck
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.core.util; package org.eclipse.dstore.core.util;
@ -166,7 +167,7 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
{ {
// something really bad happened // something really bad happened
_canExit = true; _canExit = true;
if (_xmlParser.getPanicException() != null) if (_xmlParser.getPanicException() != null && (_dataStore != null && _dataStore.isConnected()))
handleError(_xmlParser.getPanicException()); handleError(_xmlParser.getPanicException());
} }
} }

View file

@ -20,6 +20,7 @@
* David McKnight (IBM) - [282364] [dstore][multithread] timer-threads stay active after disconnect * 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) - [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) - [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; package org.eclipse.dstore.internal.core.server;
@ -52,6 +53,7 @@ public class ServerCommandHandler extends CommandHandler
{ {
private long _timeout; private long _timeout;
private boolean _serverTimedOut = false; private boolean _serverTimedOut = false;
private boolean _serverDone = false;
public ServerIdleThread(long timeout) public ServerIdleThread(long timeout)
{ {
@ -60,7 +62,7 @@ public class ServerCommandHandler extends CommandHandler
public void run() public void run()
{ {
while (!_serverTimedOut) while (!_serverTimedOut && !_serverDone)
{ {
if (_dataStore.getClient() != null) { if (_dataStore.getClient() != null) {
_dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "ServerIdleThread.waitForTimeout()..."); //$NON-NLS-1$ _dataStore.getClient().getLogger().logInfo(this.getClass().toString(), "ServerIdleThread.waitForTimeout()..."); //$NON-NLS-1$
@ -86,6 +88,12 @@ public class ServerCommandHandler extends CommandHandler
_dataStore.getClient().disconnectServerReceiver(); _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() protected synchronized void waitForTimeout()
@ -217,7 +225,7 @@ public class ServerCommandHandler extends CommandHandler
} }
if (_serverIdleThread.isAlive()){ if (_serverIdleThread.isAlive()){
_serverIdleThread._serverTimedOut = true; _serverIdleThread._serverDone = true;
_serverIdleThread.interrupt(); _serverIdleThread.interrupt();
} }
_serverIdleThread = null; _serverIdleThread = null;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,6 +14,7 @@
* Contributors: * Contributors:
* David McKnight (IBM) - [232233] [dstore] Buffer in DataElement is not retained * 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) - [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; package org.eclipse.dstore.internal.core.util;
@ -81,7 +82,7 @@ public class XMLgenerator
{ {
_dataStore = dataStore; _dataStore = dataStore;
_state = EMPTY; _state = EMPTY;
_bufferSize = 100000; _bufferSize = 200000; // doubled this since it was a little on the small end before
_document = new StringBuffer(_bufferSize); _document = new StringBuffer(_bufferSize);
@ -159,7 +160,7 @@ public class XMLgenerator
_document.append('\n'); _document.append('\n');
int length = _document.length(); int length = _document.length();
if (length > _bufferSize) if (length +1000 > _bufferSize)
{ {
flushData(); flushData();
} }
@ -519,32 +520,34 @@ public class XMLgenerator
*/ */
public synchronized void generate(DataElement object, byte[] bytes, int size, boolean isAppend, boolean binary) public synchronized void generate(DataElement object, byte[] bytes, int size, boolean isAppend, boolean binary)
{ {
String tagType = XMLparser.STR_FILE; if (_dataStore != null && (_dataStore.isVirtual() || _dataStore.isConnected())){
if (isAppend) String tagType = XMLparser.STR_FILE;
{ if (isAppend)
tagType += ".Append"; //$NON-NLS-1$ {
} tagType += ".Append"; //$NON-NLS-1$
if (binary) }
{ if (binary)
tagType += ".Binary"; //$NON-NLS-1$ {
} tagType += ".Binary"; //$NON-NLS-1$
}
if (object != null)
{ if (object != null)
startTag(tagType); {
addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE)); startTag(tagType);
addAttribute(DE.P_ID, object.getAttribute(DE.A_ID)); addAttribute(DE.P_TYPE, object.getAttribute(DE.A_TYPE));
addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME)); addAttribute(DE.P_ID, object.getAttribute(DE.A_ID));
addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE)); addAttribute(DE.P_NAME, object.getAttribute(DE.A_NAME));
addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE)); addAttribute(DE.P_VALUE, object.getAttribute(DE.A_VALUE));
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION)); addAttribute(DE.P_SOURCE, object.getAttribute(DE.A_SOURCE));
addAttribute(DE.P_SOURCE_LOCATION, object.getAttribute(DE.A_SOURCE_LOCATION));
addReferenceTypeAttribute(object);
addReferenceTypeAttribute(object);
addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$
addFile(bytes, size, binary); addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$
addFile(bytes, size, binary);
endTag(tagType);
endTag(tagType);
}
} }
} }
@ -557,24 +560,27 @@ public class XMLgenerator
*/ */
public synchronized void generate(DataElement object, byte[] bytes, int size) 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) String tagType = XMLparser.STR_CLASS;
{
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); 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$ addReferenceTypeAttribute(object);
addFile(bytes, size, true);
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) public void generate(DataElement object, int depth)
{ {
if ((object != null) && (depth >= 0)) if (_dataStore != null && (_dataStore.isVirtual() || _dataStore.isConnected())){
{ if ((object != null) && (depth >= 0))
String tagType = XMLparser.STR_DATAELEMENT;
if (object.isUpdated() && !object.isPendingTransfer())
{ {
} String tagType = XMLparser.STR_DATAELEMENT;
else
{ if (object.isUpdated() && !object.isPendingTransfer())
if (object.isDeleted() && _ignoreDeleted)
{ {
} }
else else
{ {
object.setPendingTransfer(false); if (object.isDeleted() && _ignoreDeleted)
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);
}
} }
else
// end generation {
endTag(tagType); 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);
}
} }
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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) [350315][dstore] regress change made for bug 305218
* David McKnight (IBM) - [358301] [DSTORE] Hang during debug source look up * 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) - [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; package org.eclipse.dstore.internal.core.util;
@ -563,8 +564,8 @@ public class XMLparser
boolean done = false; boolean done = false;
try { try {
while (!done) while (!done && (_dataStore != null && _dataStore.isConnected()))
{ {
String xmlTag = readLine(reader, socket); String xmlTag = readLine(reader, socket);
if (xmlTag != null) if (xmlTag != null)