Commit Graph
260 Commits
Author SHA1 Message Date
nlevitt f20b3eee30 Fix HER-1935 Many calls to File.mkdirs() and other file/dir methods don't check the return value. Also fix bug where pointless empty directories were created in scratch dir.
* BasicProfileTest.java, SelfTestBase.java, CrawlControllerTest.java, PrecedenceLoader.java, MigrateH1to3Tool.java, CrawlerLoggerModule.java, StatisticsTracker.java, CheckpointUtils.java, BdbUriUniqFilter.java, ARCWriterProcessorTest.java, WARCWriterProcessorTest.java, PersistProcessor.java, WriterPoolProcessor.java, PrefixFinderTest.java, StoredQueueTest.java, FileUtilsTest.java, ObjectIdentityBdbManualCacheTest.java, ObjectIdentityBdbCacheTest.java, ObjectPlusFilesOutputStream.java, TestUtils.java, TmpDirTestCase.java, Engine.java
    Replace calls to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir). In these cases the calls were either already in a spot where the possible IOException would be handled appropriately, or the line was trivially moved into such a block.
* ActionDirectory.java, Engine.java
    replace calls to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir), and throw IllegalStateException on failure
* BdbModule.java
    setup() - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir) and add "throws IOException" - conveniently the place where this method is called was already in a try block that catches IOException
* Checkpoint.java
    generateFrom() - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir) and add "throws IOException"
* CheckpointService.java
    move call to Checkpoint.generateFrom() inside existing try block since it now can throw IOException
* Recorder.java
    ensure(File) - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir), and throw IllegalStateException on failure
    new Recorder(File,String,int,int) - call ensure() on the correct object, the containing directory; and remove redundant call to ensure()
2011-09-12 20:12:10 +00:00
nlevitt f7cc187b09 * ANVLRecord.java
remove accidentally committed test code
2011-09-12 18:22:55 +00:00
nlevitt d2306fced6 Fix for HER-1934 ANVLRecord: clone() method does not call super.clone()
* ANVLRecord.java
    clone() - return (ANVLRecord) super.clone() - this does the right thing
2011-09-12 18:21:21 +00:00
nlevitt 0a28717500 Fix for HER-1922 ThreadLocalHttpConnectionManager: possible memory leak due to non-static inner class.
* ThreadLocalHttpConnectionManager.java
    make nested class ConnectionInfo static so it doesn't reference instance of containing class
2011-09-12 17:53:25 +00:00
nlevitt 40ff3affa3 * ObjectIdentityMemCache.java
fix mistake in r7240 - 'val.setIdentityCache()' was no longer being called the first time through, when the object comes from the 'supplier' (thanks Gordon)
2011-09-12 17:09:29 +00:00
nlevitt 24f4b715ec Various little cleanups including several discovered by Aaron using an automated tool.
* WorkQueueFrontier.java
   (HER-1925) avoid 2 possible null pointer dereferences
* CrawlController.java
    getState() - change declared return type from Object to State
* CrawlerLoggerModule.java
    (HER-1932) remove unused, unset field "reports"
* BdbCookieStorage.java
    elide pointless extra variable
* FetchHTTP.java, DownloadURLConnection.java, ProcessUtils.java
   (HER-1933) use Arrays.toString() for logged arrays
* CrawlServer.java
    - remove unused field robotstxtChecksum
    - updateRobots() - avoid reinventing existing utility class InstanceofPredicate
* ExternalGeoLookupInterface.java
    (HER-1938) extend Serializable, since ExternalGeoLocationDecideRule is declared Serializable and has a ExternalGeoLookupInterface field
* DecideRuleSequence.java
    (HER-1937) make field fileLogger transient
* PersistLogProcessor.java
    (HER-1924) remove field recoveryCheckpoint shadowing same field in superclass Processor
* ExtractorUniversal.java
    (HER-1920) use return value of potentialTLD.toLowerCase() as it appears was intended
* ARCWriterProcessor.java
    (HER-1928) avoid possible null pointer dereference
* S3URLConnection.java
    (HER-1933) set S3ServiceException as cause of rethrown IOException, and do not put stacktrace array in message
* ObjectIdentityMemCache.java
    (HER-1929) avoid possible null pointer dereference
* .classpath
    more source jar references, other cleanup
2011-09-12 02:12:44 +00:00
nlevitt 794c41ebd3 Patch from Kenji to fix "weird 'NoSuchElement' exception retrieving XML response from H3 web interface. It appeared to be concurrency related.... Probably Histotable was accessed concurrently from my JMX interface and web interface and it left Histotable in an inconsistent state. Much less likely without JMX monitoring, but it could also happen with H3 without JMX" (Kenji)
* Histotable.java
    make tally(K,long) synchronized
2011-09-01 21:04:56 +00:00
nlevitt e6de9cd96b * Sheet.java
prime() - fix exception triggered in process of handling earlier real exception, which was masking the real exception - see http://tech.groups.yahoo.com/group/archive-crawler/message/7303
2011-08-30 22:41:37 +00:00
nlevitt 62e1c835dd Fix HER-1913 cookies not being sent
* CookieSpecBase.java
    match(String, int, String, boolean, SortedMap) - use InternetDomainName.name() instead of .toString(), since the latter doesn't return the plain old domain name
* Cookie.java
    javadoc typo
2011-07-26 19:07:26 +00:00
nlevitt 3a4419967d Remove PathFixupListener, which was only used for SurtPrefixedDecideRule initialization, now done differently as of r7218.
* ConfigPathConfigurer.java
    remove calls to PathFixupListener
* PathFixupListener.java
    removed
2011-07-25 23:10:02 +00:00
gojomo a69126ad21 Reduce redundant Pattern instance caching
* TextUtils
    maintain global Pattern soft-cache by regex string key
2011-07-20 23:04:26 +00:00
gojomo 421164aaab * ConfigPathConfigurer
log as WARNING when snapshot not possible because launch directory not yet available
2011-07-16 17:49:11 +00:00
nlevitt b90aa89e4b More on HER-1901 - fix build by refactoring launch dir initialization into PathSharingContext; refactor config path interpolation mostly into ConfigPathConfigurer; various tweaks
* ActionDirectory.java, CrawlerLoggerModule.java, StatisticsTracker.java, SurtPrefixedDecideRule.java, WriterPoolProcessor.java, profile-crawler-beans.cxml
    use camelcase ${launchId} 
* CheckpointService.java, JobResource.java
    rename getAvailableCheckpointDirectories() to findAvailableCheckpointDirectories() so that it's not treated as a bean property
* WriterPoolProcessor.java, WriterPoolSettingsData.java, WriterPoolMember.java
    rename getOutputDirs() to calcOutputDirs() so that it's not treated as a bean property
* ConfigPath.java
    let ConfigPathConfigurer to do interpolation of ${launchId}
* ConfigFile.java
    let ConfigPathConfigurer do the snapshotting of config file
* CrawlJob.java, PathSharingContext.java
    remove launchDir initialization out of CrawlJob into PathSharingContext
* ConfigPathConfigurer.java
    - remove special handling of WriterPoolProcessor store paths; instead, look in beans for ConfigPaths within Iterables
    - have each ConfigPath hold reference to this ConfigPathConfigurer to use for interpolating ${launchId} and snapshotting config files
2011-07-15 19:39:32 +00:00
gojomo 1bfbec8772 fix build; move Preformatter to package (commons) where first referenced 2011-07-15 19:02:14 +00:00
gojomo be12d1e8f3 calmer logging (fewer alerts in job.log/alerts.log/heritrix_out.log)
* Recorder
    object to unsupported content-encodings when first set
* FetchHTTP
    note as annotation unsupported content-encodings
* Link
    not as annotation when base URI is used for absent via
* ExtractorHTML
    downgrade char-sequence reading problem (often a chunking problem) to WARNING from SEVERE
2011-07-14 06:35:07 +00:00
gojomo 5e2e458469 * StoredQueue
(size) more robust against concurrent emptying
2011-07-14 06:24:14 +00:00
nlevitt 9eb0c137e8 HER-1901 twiddles
* CrawlJob.java
    decided to go with plain timestamp17 as launch id, no "launch-" prefix
* ConfigPathConfigurer.java
    refactored special remembering of WriterPoolProcessor storePaths out of fixupPaths()
2011-07-14 02:03:01 +00:00
gojomo 6a3072ef46 more rapidly release refs for finished CrawlURIs
* UriProcessingFormatter, Preformatter, GenerationFileHandler
    improve preformat-outside-synchronized optimization so that the LogRecord/CrawlURI doesn't linger until next displaces it
* CrawlURI
    (processingCleanup) null more of last-processing-run collected values
2011-07-14 01:14:04 +00:00
nlevitt 4d966ae70b More on HER-1901 - support ${launch-id} interpolation on W/ARCWriterProcessor storePaths
* WriterPoolProcessor.java, ARCWriterProcessor.java, WARCWriterProcessor.java
    change type of storePaths to List<ConfigPath> and handle appropriately
* ConfigPathConfigurer.java
    fixupPaths() - old code did not touch WriterPoolProcessor storePaths, since they're deeply nested inside the bean, but they need to be remembered for later interpolation of ${launch-id}, so add special handling
2011-07-13 20:18:51 +00:00
nlevitt 4250e07de9 HER-1901 timestamped subdirectory for each launch
* HardLinker.java
    renamed FilesystemLinkMaker.java
* FilesystemLinkMaker.java
    add support for symbolic links
* CLibrary.java
    new method symlink()
* BdbModule.java
    use new class name FilesystemLinkMaker
* CrawlJob.java
    at crawl launch, create launch directory launch-{timestamp17}, copy cxml there, symlink "current" to launch dir, inform ConfigPaths
* ConfigPath.java
    interpolate ${launch-id} in configured paths
* ConfigFile.java
    obtainReader() - snapshot config files to launch dir when they are read
* ActionDirectory.java
    default doneDir now ${launch-id}/actions-done
    actOn() - symlink from old style done dir action/done to done files
* SurtPrefixedDecideRule.java
    default surtsDumpFile now ${launch-id}/surts.dump
    pathsFixedUp() - this gets called at build time, but we don't want anything written to disk until launch time, so remove call to dumpSurtPrefixSet() here
* CrawlerLoggerModule.java
    default logs dir now ${launch-id}/logs
* StatisticsTracker.java 
    default reports dir now ${launch-id}/reports
* WriterPoolProcessor.java
    default writer base path now ${launch-id} 
* profile-crawler-beans.cxml
    update to reflect new default paths under launch dirs
* PropertyUtils.java
    fix javadoc typo
2011-07-13 19:18:55 +00:00
gojomo d742434b4e [HER-1911] make writer-pool 'maxActive' setting adjustable mid-crawl
* WriterPool
    make new LARGEST_MAX_ACTIVE (255) the capacity of the reuse-pool, so that the maxActive property may vary up to that and still work; also handle more gracefully the failure of trying to use a larger number than the capacity (writer gets closed early rather than left hanging open)
2011-07-08 21:59:05 +00:00
gojomo a41809b8a7 [HER-1908] H3: upgrade to Spring 3
* pom.xml, .classpath
    update references to necessary spring-3.0.5 packages
* SeedModule
    merge rather than replace event listeners, so that (now later) autowiring doesn't clobber the self-insertion done by anonymous (non-top-level) SurtPrefixedDecideRule bean
* HeritrixLifecycleProcessor, PathScharingContext
    use this new non-default LifecycleProcessor to avoid new Spring3 behavior of auto-start()ing context on refresh(build)
* CrawlController
    example of using @Value annotation to set default value: will offer benefits for auto-discovery of defaults for configuration interface, or enforcing maximally-explicit configurations (see [HER-1897])
* profile-crawler-beans.cxml, selftest-crawler-beans.cxml
    update templates with spring3 preamble/boilerplate
2011-07-08 04:31:54 +00:00
gojomo aa15d293e8 [HER-1909] H3: slow checkpoint resume, locking out web UI during resume
[HER-1910] H3: job-related pages very slow to render (pause mid-way through) in large crawls
* BdbModule
    option to reuse bdb data on StoredQueue-creation
* Checkpoint
    new saveWriter, loadReader utilities for creating extra checkpoint files (for the long list of ready queues)
* BdbFrontier
    on checkpoint, remember ordered list of inProcess/ready/snoozed queues (so same queues are active upon resume)
    on resume, reuse old retired/inactive StoredQueue data, and reload active queues from newly-saved list
* StoredQueue
    restore tailIndex properly when resuing old data
    more-efficient size() calculation (for HER-1910)
2011-07-08 04:30:32 +00:00
nlevitt 041554fa5d Fix for HER-1906 checkpointing gives error on Windows
* HardLinker.java
    makeHardLink() - wrap unix link() and windows CreateHardLink() and choose depending on platform
* BdbModule.java
    doCheckpoint() - use HardLinker.makeHardLink()
2011-06-24 19:24:28 +00:00
gojomo 9d2b293d4c [HER-1904] H3: OOME after a few hours of previously non-problematic crawl
* Recorder
    use min(raw-buffer size, actual recorded byte size) for char buffer size
* TextUtils
    on recycleMatcher, dereference previous 'input'
2011-06-20 20:32:14 +00:00
gojomo 88416a150a Tangent revealed by [HER-1898] eritrix 3.1 misses many pages that Heritrix 3.0 catches
* Recorder
    use intended basis for GenericReplayCharSequence in-memory-prefix
* RecordingInputStream
    reveal internal ROS buffer size
2011-06-14 03:27:21 +00:00
nlevitt 78755dd304 HER-1898 - Heritrix 3.1 misses many pages that Heritrix 3.0 catches - reported by Dan Yadgar
* GenericReplayCharSequence.java
    decode() - read another character to check for more content, rather than consult BufferedReader.ready(), since the latter sometimes returns false even when there is more to read
2011-06-14 02:11:21 +00:00
gojomo 19390f270a extra output to determine reason for slow test runs 2011-06-08 23:56:35 +00:00
gojomo 71ca9262df extra output to determine reason for slow test runs 2011-06-08 23:49:53 +00:00
gojomo 2043d1801a [HER-741] Make extractors interrogate for charset
* ReplayCharSequence, GenericReplayCharSequence
    use Charset instance rather than String-name
* Recorder
    use Charset instance ratehr than String-name
    (getContentReplayCharSequence) avoid reusing cached ReplayCharSequence when encoding-in-use has changed since it was created
    (getContentReplayPrefixString) allow requested specific charset-interpretation
* ExtractorHTML, ExtractorXML
    work with Charset instances
    double-check that in-content-declarations are self-consistent before using
    recycle matcher instances
    change minor charset problems/decisions to a crawl.log annotation
2011-06-03 21:28:03 +00:00
gojomo 4ea85ac817 * commons/pom.xml
bump test heap back to -Xmx1g
* BloomFilterTest
    restore 495MB-filter test
2011-05-31 22:28:39 +00:00
gojomo e791c23751 * BloomFilterTest
temporarily disable 495MB test until build box has more RAM
2011-05-28 01:10:33 +00:00
nlevitt 11b54e7ec1 Fix HER-1888 StringIndexOutOfBoundsException in
Recorder.getContentReplayPrefixString()
* Recorder.java 
    getContentReplayPrefixString() - return empty string there's no content, to
    avoid exception
2011-05-19 23:19:11 +00:00
nlevitt 2a6aca0fcd * Recorder.java
getContentReplayPrefixString() - use fallback character encoding if
    necessary, much like getContentReplayCharSequence()
2011-05-03 17:14:28 +00:00
nlevitt d159b4e106 HER-741 Make extractors interrogate for charset
* ExtractorXML.java
    if charset not spec'd in http header look for <?xml encoding=""?>
* ExtractorHTML.java 
    lookForEncodingInContent() - 
    1. look for <meta http-equiv="content-type"...>
    2. if not found then look for <meta charset="">
    3. if not found then <?xml encoding=""...?>
* Recorder.java
    setCharacterEncoding() - If new encoding is different from old encoding,
    close replayCharSequence and set to null, which will trigger recreation on
    next retrieval.
2011-04-22 18:43:18 +00:00
nlevitt a2eaa9d6ac HER-1820 followup
* UriUtils.java
    NAIVE_LIKELY_URI_PATTERN - revert change and unpublicize
    NAIVE_URI_EXCEPTIONS - add some mimetype strings that came up in testing
    isLikelyFalsePositive() - unpublicize
* ExtractorXML.java
    XML_URI_EXTRACTOR - do not use NAIVE_LIKELY_URI_PATTERN
    shouldExtract() - check for mimetype application/vnd.openxmlformats which is not xml
    processXml() - use UriUtils.isLikelyUri()
2011-04-21 17:18:01 +00:00
nlevitt 70d21ca2da HER-1820 more eager xml link extraction
* ExtractorXML.java
    instead of considering only strings that start with http(s):, consider all
    strings that match UriUtils.NAIVE_LIKELY_URI_PATTERN (and, as before,
    constitute the entirety of the xml tag content or attribute value)
* UriUtils.java
    - NAIVE_LIKELY_URI_PATTERN - add quotes to the excluded characters so it
      does not eat the closing quote when matching xml attribute values, and
      make visibility public for use in ExtractorXML
    - isLikelyUri() - refactor false positive check into new method
      isLikelyFalsePositive() so that it can be used in ExtractorXML avoiding
      redundant check against NAIVE_LIKELY_URI_PATTERN
2011-04-20 01:18:00 +00:00
nlevitt b064d43db5 Fix HER-1792 backslashes in urls can in some cases really mean backslashes
(specifically, when they're in the query string)
* UURIFactory.java
    fixup() - replace \ with / up to the first ? in the url, instead of
    anywhere in the url
    and update comments
* UURIFactoryTest.java
    backslash test
2011-04-19 02:11:20 +00:00
gojomo 2be8af10a9 * ArchiveReaderFactory
comment about possible weakness in checking response to Range:d request
2011-04-16 08:06:03 +00:00
gojomo 8bc70dd82a [HER-1881] GZIPMembersInputStream.compressedSkip(long) ignores return value of in.skip(offset)
* GZIPMembersInputStream
    use ByteStreams.skipFully to skip desired amount or hit EOF
2011-04-16 07:43:53 +00:00
gojomo 722a8549ab [HER-1821] H3: implement hard-link-based BDB/state-dir checkpointing
* BdbModule.java
    new setting, useHardLinkCheckpoints, default true
    doCheckpoint now creates hard-links to active log files from the in-environment checkpoint-dir
    doRecover now relinks from checkpoint-dir files, when available, in preference to whatever is already in the env-dir
* pom.xml
    bring in JNA for native calls
* CLibrary
    wrapper for the link() function
2011-04-12 00:09:51 +00:00
gojomo 6388dc7605 [HER-1878] NullPointerException when parsing (some?) WARC files over slow connections
* GZIPMembersInputStream
    override OpenJDK7GZIPInputStream.readTrailer to not rely on available() as indicator of end-of-stream
    fix membersIterator hasNext() to also not rely on available() as indicator of end-of-stream
* ArchiveReader
    change innerHasNext to peek one byte (using mark/reset) rather than rely on available() as indicator of end-of-stream
    remove redundant getInputStream accessor in favor of field-name-matching getIn/setIn
* ArchiveReaderFactory, (W)ARCReaderFactory
    remove no-longer-necessary RepositionableStream references
    use getIn() rather than getInputStream()
2011-04-11 22:58:05 +00:00
gojomo 3a53da1073 adapted tests for other changes 2011-04-06 20:52:06 +00:00
gojomo e29e7dd36a comment typo 2011-04-06 20:51:40 +00:00
gojomo 9f3b8d11db * ReplayInputStream
constructor comment about using destroy()
2011-04-06 20:51:14 +00:00
gojomo c5eb3ffd53 [HER-1053] compressed HTTP fetch: "Accept-encoding: gzip"
[HER-728] Offer replay stream that has been un-chunked (whether because response was HTTP/1.1 or used chunked in HTTP/1.0 against spec)
[HER-1876] Offer HTTP/1.1 option - for chunked transfer-encoding (but not persistent connections) 
* FetchHTTP
    add 'acceptCompression' and 'useHTTP11' properties, both default false
* Recorder
    track whether recorded-input is transfer-encoded (chunked) or content-encoded (gzip etc)
    offer alternate replay streams for 
      (1) raw 'messageBody'; 
      (2) entity (un-chunked if necessary)
      (3) content (decompressed if necessary)
    always content & GenericReplayCharSequence for CharSequence replays
* GenericReplayCharSequence
    always use a stream (rather than random-access buffer)
    always decode to prefix buffer first, so short content never touches disk no matter the encoding
* InMemoryReplayCharSequence
    deleted; 'Generic' now works similarly for small content and anyway random-access for single-byte-encodings is now rarely possible (given deconding streams)
* RecordingInputStream, RecordingOutputStream
    adjust for changed stream names, functionality moved to Recorder
* ReplayCharSequence
    use Charset instances rather than names
* ReplayInputStream
    add convenience constructor (and tmp-file-destroy) for copying any other inputStream into a seekable ReplayInputStream
2011-04-06 20:42:43 +00:00
gojomo 3f98fc248b * ArchiveUtils
(readFully) return actual number of bytes read into array
* FileUtils
    (readFullyToFile) simplify; also return total bytes read
2011-04-06 20:22:30 +00:00
gojomo 1395854f9a [HER-1865] JDK6u23 breaks GzippedInputStream & W/ARCReaders with different GZIP handling
* OpenJDK7GZIPInputStream.java, OpenJDK7InflatedInputStream.java
    backport the working GZIP implementation from OpenJDK7, with minimal 
    renames/imports/private-to-protected changes to enable member-at-a-time reading
* GZIPMembersInputStream
    base on OpenJDK7 implementation to avoid pre- & post-6u23 codepaths, and 6u23/24 readHeader bug
    override readTrailer to set member-end; update comment to reflect end-uncertainty without EOF-per-member-mode
* GZIPMembersInputStreamTest, ARCWriterTest
    test tweaks
2011-03-30 02:42:26 +00:00
gojomo 3fc3d324e8 * ArchiveReaderFactory
avoid misinterpreting a "c:" local path as a URI scheme
2011-02-26 01:04:26 +00:00
gojomo 2f9a8b860d * GZIPMembersInputStream
ensure mark()ing more frequently, when reset to before current position won't be needed
* ArchiveReaderFactory
    avoid misinterpreting a "c:" local path as a URI scheme
2011-02-26 00:59:10 +00:00