Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fixes for concurrency exceptions and failed database integrity verification - added link to yacystats peer when peer is more than one day old
orbiter37baa8bae335
diff --git a/defaults/yacy.init b/defaults/yacy.initindex 63ee34f4d..5ca48584a 100644--- a/defaults/yacy.init+++ b/defaults/yacy.init@@ -174,7 +174,6 @@ httpdMaxBusySessions = 200# users shall be encouraged to use the htdocs path for individual content,# not this path defined herehtRootPath = htroot-htTemplatePath = htroot/env/templates# the htroot path# root path for the httpd file serverdiff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex 8db723bd8..926e2421a 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -29,12 +29,11 @@ import java.util.Collection;import java.util.ConcurrentModificationException;import java.util.Date;import java.util.Iterator;-import java.util.LinkedList;-import java.util.List;import java.util.Locale;import java.util.Map;import java.util.TreeSet;import java.util.Map.Entry;+import java.util.concurrent.ConcurrentLinkedQueue;import java.text.SimpleDateFormat;import net.yacy.cora.protocol.Domains;@@ -55,7 +54,7 @@ public class AccessTracker_p {private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);private static final Collection<Track> listclone(final Collection<Track> m) {- final List<Track> accessClone = new LinkedList<Track>();+ final Collection<Track> accessClone = new ConcurrentLinkedQueue<Track>();try {accessClone.addAll(m);} catch (final ConcurrentModificationException e) {}diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.javaindex a0901ef0c..d5e37280a 100644--- a/htroot/CrawlResults.java+++ b/htroot/CrawlResults.java@@ -197,8 +197,8 @@ public class CrawlResults {urlstr = metadata.url().toNormalform(false, true);urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL}- initiatorSeed = entry.getValue() == null ? null : sb.peers.getConnected(new String(entry.getValue().initiatorHash));- executorSeed = entry.getValue() == null ? null : sb.peers.getConnected(new String(entry.getValue().executorHash));+ initiatorSeed = entry.getValue() == null || entry.getValue().initiatorHash == null ? null : sb.peers.getConnected(new String(entry.getValue().initiatorHash));+ executorSeed = entry.getValue() == null || entry.getValue().executorHash == null ? null : sb.peers.getConnected(new String(entry.getValue().executorHash));prop.put("table_indexed_" + cnt + "_dark", (dark) ? "1" : "0");prop.put("table_indexed_" + cnt + "_feedbackpage", "CrawlResults.html");diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.templateindex 5a8e0d916..490b1e112 100644--- a/htroot/env/templates/header.template+++ b/htroot/env/templates/header.template@@ -99,7 +99,7 @@<li><a href="http://forum.yacy.de" class="MenuItemLink">Deutsches Forum</a></li><li><a href="http://www.yacy-forum.org" class="MenuItemLink">English Forum</a></li><li><a href="http://wiki.yacy.de" class="MenuItemLink">YaCy Project Wiki</a></li>- <li><a href="http://www.yacystats.de" class="MenuItemLink">YaCy Statistics</a></li>+ <li><a href="#(newpeer)#http://www.yacystats.de/peer/#[peerhash]#::http://www.yacystats.de#(/newpeer)#" class="MenuItemLink">#(newpeer)#Peer Statistics::YaCy Statistics#(/newpeer)#</a></li></ul></li></ul>diff --git a/htroot/proxymsg/error.html b/htroot/proxymsg/error.htmlindex 496e149d3..2ccb15555 100644--- a/htroot/proxymsg/error.html+++ b/htroot/proxymsg/error.html@@ -6,10 +6,10 @@</head><body id="error"><div class="head">- <h1 class="head">YaCy - Distributed Web Indexing - Administration</h1>+ <h3 class="head">YaCy</h3></div><div class="content">- <h2>Problems with request: <span class="settingsValue">#[requestMethod]# #[requestURL]#</span></h2>+ <p>request: <span class="settingsValue">#[requestMethod]# #[requestURL]#</span></p><p class="tt">#[httpStatus]#</p>#(errorMessageType)#<!-- 0 --><p><strong>unspecified error</strong></p>diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.javaindex a21999ec3..cf17c6beb 100644--- a/source/de/anomic/http/server/HTTPDFileHandler.java+++ b/source/de/anomic/http/server/HTTPDFileHandler.java@@ -104,6 +104,7 @@ import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.server.servletProperties;import de.anomic.yacy.yacyBuildProperties;+import de.anomic.yacy.yacySeed;import de.anomic.yacy.graphics.EncodedImage;public final class HTTPDFileHandler {@@ -117,7 +118,6 @@ public final class HTTPDFileHandler {private static File htRootPath = null;private static File htDocsPath = null;- private static File htTemplatePath = null;private static String[] defaultFiles = null;private static File htDefaultPath = null;private static File htLocalePath = null;@@ -170,14 +170,6 @@ public final class HTTPDFileHandler {final File repository = new File(htDocsPath, "repository");if (!repository.exists()) repository.mkdirs();- // create a htTemplatePath- if (htTemplatePath == null) {- htTemplatePath = theSwitchboard.getAppPath("htTemplatePath","htroot/env/templates");- if (!(htTemplatePath.exists())) htTemplatePath.mkdir();- }- //This is now handles by #%env/templates/foo%#- //if (templates.isEmpty()) templates.putAll(httpTemplate.loadTemplates(htTemplatePath));-// create htLocaleDefault, htLocalePathif (htDefaultPath == null) htDefaultPath = theSwitchboard.getAppPath("htDefaultPath", "htroot");if (htLocalePath == null) htLocalePath = theSwitchboard.getDataPath("locale.translated_html", "DATA/LOCALE/htroot");@@ -818,6 +810,9 @@ public final class HTTPDFileHandler {templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic"));templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((Switchboard) switchboard).peers.myID());templatePatterns.put(servletProperties.PEER_STAT_MYTIME, DateFormatter.formatShortSecond());+ yacySeed myPeer = sb.peers.mySeed();+ templatePatterns.put("newpeer", myPeer.getAge() >= 1 ? 0 : 1);+ templatePatterns.putHTML("newpeer_peerhash", myPeer.hash);//System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug} catch (final InvocationTargetException e) {if (e.getCause() instanceof InterruptedException) {diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.javaindex 7a6136ce1..b7e7b1d39 100644--- a/source/de/anomic/server/serverCore.java+++ b/source/de/anomic/server/serverCore.java@@ -155,7 +155,9 @@ public final class serverCore extends AbstractBusyThread implements BusyThread {try { Thread.sleep(100); } catch (final InterruptedException ex) {}// trying to interrupt session- s.notify();+ synchronized (s) {+ s.notify();+ }s.interrupt();try {Thread.sleep(10);} catch (final InterruptedException ex) {}diff --git a/source/net/yacy/kelondro/blob/HeapReader.java b/source/net/yacy/kelondro/blob/HeapReader.javaindex 84922e2ff..1d9a7a50e 100644--- a/source/net/yacy/kelondro/blob/HeapReader.java+++ b/source/net/yacy/kelondro/blob/HeapReader.java@@ -406,7 +406,12 @@ public class HeapReader {// access the file and read the containerfile.seek(pos);final int len = file.readInt() - index.row().primaryKeyLength;- if (len < 0) throw new IOException("file " + file.file() + " corrupted at " + pos + ": negative len. len = " + len + ", pk.len = " + index.row().primaryKeyLength);+ if (len < 0) {+ // database file may be corrupted and should be deleted :-((+ Log.logSevere("HeapReader", "file " + file.file() + " corrupted at " + pos + ": negative len. len = " + len + ", pk.len = " + index.row().primaryKeyLength);+ // to get lazy over that problem (who wants to tell the user to stop operation and delete the file???) we work on like the entry does not exist+ return null;+ }if (MemoryControl.available() < len * 2 + keepFreeMem) {if (!MemoryControl.request(len * 2 + keepFreeMem, true)) throw new RowSpaceExceededException(len * 2 + keepFreeMem, "HeapReader.get()"); // not enough memory available for this blob}