Commit Graph
369 Commits
Author SHA1 Message Date
nlevitt 10b3686ba8 Fix race condition which can happen with multiple concurrent "launch"es - can end up with duplicate ToePools like before r7268, probably other problems
* CrawlJob.java
    launch() - synchronize this method - sort of a blunt fix but probably safest and shouldn't affect performance
2011-10-07 23:18:43 +00:00
nlevitt 19e94f07d1 Fix race condition encountered by Travis and Adam where two ToeThread pools are created, one on "launch" and one on "unpause"
* CrawlController.java
    requestCrawlResume() - do not create ToePool (creation here appeared to be inherited cruft), paused crawl must already have toe pool
2011-10-07 01:54:29 +00:00
nlevitt b4e6f43052 Unset script engine variables after scripts complete, allowing memory to be freed up sooner - see also r7252
* ScriptResource.java, ActionDirectory.java, ScriptedDecideRule.java
2011-10-06 18:01:01 +00:00
nlevitt a76f9818f9 Fix HER-1955 Some annoying interaction between new creation of latest link and disk full java bean
* DiskSpaceMonitor.java
    checkAvailableSpace() - really do ignore non-existent paths, as comment and log message claim is done
2011-09-30 20:07:15 +00:00
nlevitt e88d1d9df7 CrawlController FINISHED doesn't guarantee we're ready for shutdown, so add new boolean and event for that purpose.
Elaboration: CrawlJob needs all beans to receive FINISHED event before teardown. Can't easily guarantee CrawlJob receives the event last. Actually, spring provides a way, org.springframework.core.Ordered, but to make a bean receive events last, *every other bean* must implement Ordered. So this way is simpler.
* CrawlController.java
    new member variable isStopComplete and event StopCompleteEvent 
* CrawlJob.java
    rely on cc.isStopComplete() or StopCompleteEvent to indicate ready for teardown
2011-09-29 17:22:34 +00:00
nlevitt de9975ee23 * CrawlJob.java
instantiateContainer() - do not call teardown() on exception from ac.refresh() - can throw IllegalStateException
    teardown() - put all uses of variable cc inside not-null check
2011-09-29 16:09:44 +00:00
nlevitt 747fbc0a0f Fix for HER-1954 bdb closed at crawl finish instead of teardown -- refactor crawl finish and teardown
* PathSharingContext.java
    start(), doStart(), stop(), doStop() - remove these overloaded methods, because the spring bug they were working around seems to be fixed, not seeing any problems with cyclical dependencies - might be this one https://jira.springsource.org/browse/SPR-7266
    doClose() - remove because superclass version seems to work fine (this method generally wasn't being called anyway, though it would be now with other changes in this checkin)
* CrawlJob.java
    refactor teardown to call close() on the ApplicationContext, which calls destroy() on any beans that implement DisposableBean - this is now the way to have beans do stuff at teardown
* CrawlController.java
    send FINISHED crawl state event after calling appCtx.stop() so that isFinished() can indicate ready-ness for teardown
* BdbModule.java
    move close() to teardown, i.e. implementation of DisposableBean.destroy(); remove shutdown hook and rely on teardown; related tweaks
* WorkQueueFrontier.java, CrawlerLoggerModule.java, BdbUriUniqFilter.java
    move close() to teardown
* CrawlMapper.java, AbstractFrontier.java, PreloadedUriPrecedencePolicy.java, FetchWhois.java, FetchHTTP.java, PersistLogProcessor.java, WriterPoolProcessor.java
    add comments about cleanup that maybe should wait until teardown
* UriUniqFilter.java
    remove incorrect(?) comment
2011-09-29 00:39:55 +00:00
nlevitt de856f10a6 Fix possible memory leak (encountered in h1, see r7255)
* ToeThread.java
    run() - set local variable curi=null when finished with it, because the jvm seems to be holding on to it even after the containing block is finished
2011-09-28 00:22:53 +00:00
nlevitt f704ca5bc7 Fix HER-1953 all api xml elements are camelcase except sizeTotalsReport fields
* CrawledBytesHistotable.java
    camelcase notModified, dupByHash, notModifiedCount, dupByHashCount, novelCount
* CrawlJob.java
    sizeTotalsReportData() - camelcase totalCount
2011-09-28 00:19:44 +00:00
nlevitt 6adc3c285f * Heritrix.java
usage()
        -        out.print("Your arguments were: "+StringUtils.join(args, ' '));
        +        out.println("Your arguments were: "+StringUtils.join(args, ' '));
2011-09-27 04:08:58 +00:00
nlevitt f242522efc Fix for HER-1950 URIAuthorityBasedQueueAssignmentPolicy KeyedProperties shadows superclass QueueAssignmentPolicy KeyedProperties, breaking sheet overlay of properties defined in superclass
* URIAuthorityBasedQueueAssignmentPolicy.java
    remove field kp, accessor getKeyedProperties(); instead inherit these from superclass QueueAssignmentPolicy
2011-09-20 23:52:59 +00:00
nlevitt 54aca17757 Removing very old abandoned line of development, package org.archive.extractor 2011-09-14 21:34:26 +00:00
nlevitt 4eef2d9902 Revert change in r7240 - different return type makes recovery from checkpoints from before the change fail
* CrawlController.java
    getState() - return Object
2011-09-13 00:48:06 +00:00
nlevitt 5a4e72d902 Couple of synchronizations for HER-1943 WorkQueue: inconsistent synchronization using fields active, lastCost, peekItem, wakeTime
* WorkQueue.java
    considerActive(), unpeek() - make synchronized
2011-09-12 22:49:32 +00:00
nlevitt 48b0ddfb03 Fix for HER-1942 CheckpointService: inconsistent synchronization around use of isRunning. Doubtful if isRunning thing is a real problem, but it looks like a good idea to synchronize this method anyway, in case there are concurrent calls to it.
* CheckpointService.java
    setRecoveryCheckpointByName() - mark synchronized
2011-09-12 22:00:54 +00:00
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 221e63dbd0 Fix for HER-1921 BucketQueueAssignmentPolicy: absolute value of hashCode can be Integer.MIN_VALUE.
* BucketQueueAssignmentPolicy.java
    getClassKey() - cast value to long before taking absolute value
2011-09-12 17:02:54 +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 e38f0a73ba * profile-crawler-beans.cxml
<bean id="fetchHttp" class="org.archive.modules.fetcher.FetchHTTP">
    +  <!-- <property name="useHTTP11" value="false" /> -->
2011-09-11 17:02:32 +00:00
nlevitt d3a6dc1f58 Fix for HER-1946 Mid-Crawl Adjustment of frontier.queueTotalBudget does not propagate to retired queues.
* WorkQueueFrontier.java
    findEligibleURI() - propagate queueTotalBudget (also sessionBudget) to ensure the settings are current right before checking if queue is over budget
2011-09-09 23:23:15 +00:00
nlevitt c70f7ccbc0 * profile-crawler-beans.cxml
remove reference to defunct frontier setting "holdQueues", pointed out by Kristinn Sigurðsson
2011-08-08 23:42:47 +00:00
nlevitt ada8cbd198 Fix bug reported by Travis where in certain corner cases where urls are processed in a particular order, a seed can be incorrectly tagged with S_ROBOTS_PREREQUISITE_FAILURE
* DispositionProcessor.java
    innerProcess() - do not update server's robots info if robots fetch has been deferred
2011-08-04 01:32:09 +00:00
nlevitt 706869e586 Fix handling of server error on robots.txt - change to what appears to be the intended behavior
* DispositionProcessor.java
    innerProcess() - call server.updateRobots(curi) after special ignore-robots short-circuiting of retry cycle rather than before, so that updateRobots() deemed-not-found handling applies
* FetchHTTP.java
    call curi.setHttpMethod() right after creating the HttpMethod, instead of when processing the response; this is needed so that updateRobots() check of fetchType works properly (before this change, fetchType was "UNKNOWN" on server error)
* PreconditionEnforcer.java, CrawlServer.java
    fix typos
2011-08-02 23:28:20 +00:00
nlevitt 3cfc315de9 Fix bug reported by Travis where each url in action directory ".include" file is reported as "not canonicalized" in heritrix_out, and some end up crawled in spite of being considered included
* WorkQueueFrontier.java
    considerIncluded(CrawlURI) - call FrontierPreparer.prepare(CrawlURI) so that CrawlURI is canonicalized etc before being considered included (similar to what schedule() does)
* CrawlURI.java
    getCanonicalString(), getPolitenessDelay() - use logger instead of System.err
2011-08-02 01:07:11 +00:00
nlevitt efff6feed6 * CrawlJob.java
avoid NPE on build-then-terminate without a launch
2011-07-25 19:16:31 +00:00
nlevitt e2f29992d4 Put hard limit of 5 on seed redirects being treated as new seeds, to avoid
endless recrawling of the same url(s) in case of a redirect loop.  
* CandidatesProcessor.java
2011-07-23 02:20:35 +00:00
gojomo a490737b59 * StatisticsTracker
add 'trackSources' to make hosts-by-source-tag report optional in large crawls, where it is very expensive (and an OOME risk until other changes are also made)
2011-07-20 23:36:19 +00:00
nlevitt b3e35499ca HER-1812 Spring-ify how reports are handled - based partly on patch from Kristinn Sigurðsson
* Report.java
    make StatisticsTracker stats an argument to write() instead of a field; new properties shouldReportAtEndOfCrawl and shouldReportDuringCrawl, both default true, but configurable if desired, replacing the LIVE_REPORTS/END_REPORTS stuff in StatisticsTracker
* StatisticsTracker.java
    new property "reports", a List<Report>, which defaults (with lazy initialization) to the same reports we've always had, replacing hard-coded lists of reports classes and related code
* profile-crawler-beans.cxml
    default reports list, commented out
* SeedsReport.java FrontierSummaryReport.java MimetypesReport.java SourceTagsReport.java FrontierNonemptyReport.java CrawlSummaryReport.java ResponseCodeReport.java HostsReport.java ProcessorsReport.java ToeThreadsReport.java
    update write(PrintWriter, StatisticsTracker) arguments
* JobResource.java
    replace use of StatisticsTracker.LIVE_REPORTS
2011-07-20 17:05:12 +00:00
nlevitt 0676ded3f2 * CrawlJob.java
fix logging of job events
2011-07-16 00:48:14 +00:00
gojomo e819d197fe [HER-915] (contrib) add http proxy authentication
contributed by Adam Wilmer
* FetchHTTP.java
    properties, setup for http proxy user/password
* profile-crawler-beans.cxml
    commented-out example settings for proxy auth properties
2011-07-15 21:57:20 +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
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 c84e87c648 More HER-1901
* CrawlJob.java 
    job log in launch dir covering just that launch
2011-07-13 20:47:08 +00:00
nlevitt d5b299d1ef * CrawlJob.java
initLaunchId() - didn't mean for this method to be public
2011-07-13 20:13:13 +00:00
nlevitt c39c927447 * profile-crawler-beans.cxml
runWhileEmpty defaults to false
2011-07-13 19:20:45 +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 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
gojomo 2b0d967b32 Resolve 'Browse Beans' issue after built, pre-launch
* JobRelatedResource
    catch InvalidPropertyException, render as red error message rather than fouling entire trace of beans to web UI
* StatisticsTracker
    rename getSnapshots to listSnapshots to prevent interpretation as (invalid) bean-property
2011-06-27 22:25:12 +00:00
gojomo 842f495ee9 [HER-1905] H3: allow crawling to begin while large seed list still loading
* TextSeedModule
    refactor announceSeeds to occur in background thread if non-default blockAwaitingSeedLines value is set
    signal CountDownLatch on each line, allowing calling thread to proceed at right count
* profile-crawler-beans.cxml
    commented-out blockAwaitingSeedLines default settings (-1, meaning wait for all seed lines)
2011-06-22 21:21:26 +00:00
gojomo b9b64a6029 [HER-1776] H3: holding empty crawl for more URIs (other than 'paused')
* profile-crawler-beans.cxml
    replace obsolete pauseAtEmpty example property with replacement runWhileEmpty
2011-06-22 21:16:39 +00:00
nlevitt d3475fadbf * BdbMultipleWorkQueues.java
getFrom() - support null marker to start from first key, as appeared to be the intention
2011-06-20 18:06:41 +00:00
nlevitt d57b7751ae * SelfTestBase.java
verifyProgressStatistics() - expect "RUNNING" instead of "RESUMED" per r7180
2011-06-15 18:10:37 +00:00
gojomo 45a59d3a19 [HER-1776] H3: holding empty crawl for more URIs (other than 'paused')
* CrawlController
    change pauseAtFinish to runWhileEmpty
    add EMPTY state
    replace isStateRunning() with isActive() (RUNNING or EMPTY)
    trigger finish-test off frontier EMPTY rather than PAUSE
    in logging say 'running' rather than 'resumed' 
* Frontier
    add EMPTY state
* AbstractFrontier
    handle EMPTY like RUNNING, transition EMPTY<->RUNNING when appropriate
* StatisticsTracker
    handle EMPTY analogous to RUNNING
    in logging say 'running' rather than 'resumed' 
* CrawlJob, DiskSpaceMonitor
    replace isStateRunning() with isActive()
2011-06-15 06:01:49 +00:00
gojomo d9a53ff584 * JobRelatedResource
(writeNestedNames) use local getPropertyDescriptors(bwrap) to only show safely-displayable properties
2011-06-14 22:39:21 +00:00
gojomo 4ef6c5dc24 [HER-1899] scripting console comes back as XML in webkit browsers (Chrome, Safari)
* JobRelatedResource
    derive from BaseResource for webkit-XML-workaround
2011-06-13 23:31:36 +00:00
gojomo 99a49b2df7 Avoid treating temporarily-DEFERRED robots.txt handling as-if a failure-to-ignore in robots-ignored case
* DispositionProcessor
    treat S_DEFERRED different from other negative error statuses
2011-05-27 01:24:49 +00:00
nlevitt 3acedc86a2 Different fix for HER-1891 which also fixes HER-1890, two cases of "seed
redirect url sometimes '0 NOTCRAWLED' in seeds-report.txt even when crawled"
* CandidatesProcessor.java 
    innerProcess() - set force-fetch on outlinks promoted to seeds
2011-05-26 16:07:28 +00:00