Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup DOI (sometimes) freezes JabRef #2680

Closed
stefan-kolb opened this issue Mar 23, 2017 · 8 comments
Closed

Lookup DOI (sometimes) freezes JabRef #2680

stefan-kolb opened this issue Mar 23, 2017 · 8 comments
Labels
bug Confirmed bugs or reports that are very likely to be bugs
Milestone

Comments

@stefan-kolb
Copy link
Member

New in 4.0 Development version!

@stefan-kolb stefan-kolb added the bug Confirmed bugs or reports that are very likely to be bugs label Mar 23, 2017
@stefan-kolb
Copy link
Member Author

stefan-kolb commented Mar 23, 2017

Maybe related to #2442 or #2645?

@stefan-kolb stefan-kolb changed the title Lookup DOI sometimes freezes JabRef Lookup DOI (sometimes) freezes JabRef Mar 23, 2017
@stefan-kolb
Copy link
Member Author

@koppor @tobiasdiez

@stefan-kolb
Copy link
Member Author

Looks like it has something to do with this code

    default Optional<T> findIdentifier(BibEntry entry) throws FetcherException {
        Objects.requireNonNull(entry);

        try (InputStream stream = new BufferedInputStream(getURLForEntry(entry).openStream())) {
            List<BibEntry> fetchedEntries = getParser().parseEntries(stream);

            if (fetchedEntries.isEmpty()) {
                return Optional.empty();
            }

            // Post-cleanup
            fetchedEntries.forEach(this::doPostCleanup);

            return extractIdentifier(entry, fetchedEntries);
        } catch (URISyntaxException e) {
            throw new FetcherException("Search URI is malformed", e);
        } catch (FileNotFoundException e) {
            LOGGER.debug("Id not found");
            return Optional.empty();
        } catch (IOException e) {
            // TODO: Catch HTTP Response 401 errors and report that user has no rights to access resource
            // TODO catch 503 service unavailable and alert user
            throw new FetcherException("An I/O exception occurred", e);
        } catch (ParseException e) {
            throw new FetcherException("An internal parser error occurred", e);
        }
    }

If the service is unavailable a 503 occurs and a fetcher exception is thrown.
In the course of this JabRef freezes.

@stefan-kolb
Copy link
Member Author

After catching this error:

        doiButton.addActionListener(actionEvent -> {
            try {
                Optional<DOI> doi = WebFetchers.getIdFetcherForIdentifier(DOI.class).findIdentifier(entryEditor.getEntry());
                if (doi.isPresent()) {
                    entryEditor.getEntry().setField(FieldName.DOI, doi.get().getDOI());
                } else {
                    panel.frame().setStatus(Localization.lang("No %0 found", FieldName.getDisplayName(FieldName.DOI)));
                }
            } catch (FetcherException e) {
                LOGGER.error("Problem fetching DOI", e);
            }
        });

JabRef freezes.

@stefan-kolb stefan-kolb added this to the v4.0 milestone Mar 23, 2017
@stefan-kolb
Copy link
Member Author

stefan-kolb commented Mar 23, 2017

Ok, we got a few problems:

  • Lookup DOI action for the button is not in a separate thread (ugly but present long time ago)
  • GUI freezes when exception from above is catched. Maybe related to the start inside the FX thread 9b28d36. Also @lynyus reported that the whole GUI stopped working for him, so maybe this also triggers the freeze problem here and we need to fix the sart in FX thread method somehow.
  • Error in CrossRef (500): Maybe we should report this on CrossRef's Github repo. This happens randomly!
    http://api.crossref.org/works?query.title=A+break+in+the+clouds%3A+towards+a+cloud+definition&rows=20&offset=0 ->
{"status":"error","message-type":"exception","message-version":"1.0.0","message":{"name":"class java.lang.RuntimeException","description":"java.lang.RuntimeException: Solr returned a partial result set","message":"Solr returned a partial result set","cause":null}}
  • Error in Crossref 503 & 504
    maybe log to the console and in the status bar for the user that the service is unavailable.

@stefan-kolb
Copy link
Member Author

With reverted log addition in FX thread:
Infinite loop?!

Opening: C:\Users\stfn\Desktop\Vorlesungen\Promotion\Paper\master.bib
Opening: C:\Users\stfn\Downloads\01 - TEMP\test.bib
Problem fetching DOI
org.jabref.logic.importer.FetcherException: An I/O exception occurred
	at org.jabref.logic.importer.IdParserFetcher.findIdentifier(IdParserFetcher.java:92)
	at org.jabref.gui.entryeditor.FieldExtraComponents.lambda$getDoiExtraComponent$3(FieldExtraComponents.java:186)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://api.crossref.org/works?query.title=A+break+in+the+clouds%3A+towards+a+cloud+definition&query.author=Vaquero%2C+Luis+M+and+Rodero-Merino%2C+Luis+and+Caceres%2C+Juan+and+Lindner%2C+Maik&filter=from-pub-date%3A2008&rows=20&offset=0
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.URL.openStream(Unknown Source)
	at org.jabref.logic.importer.IdParserFetcher.findIdentifier(IdParserFetcher.java:74)
	... 37 more

No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().

@stefan-kolb
Copy link
Member Author

Also happens for get BibTeX data from DOI:

Could not copy input
java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:152)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:169)
	at org.jabref.logic.importer.fetcher.DoiFetcher.performSearchById(DoiFetcher.java:55)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:47)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:22)
	at javax.swing.SwingWorker$1.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at javax.swing.SwingWorker.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at org.jabref.logic.net.URLDownload.openConnection(URLDownload.java:297)
	... 11 more

Info cannot be found
org.jabref.logic.importer.FetcherException: Invalid URL
	at org.jabref.logic.importer.fetcher.DoiFetcher.performSearchById(DoiFetcher.java:65)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:47)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:22)
	at javax.swing.SwingWorker$1.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at javax.swing.SwingWorker.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:152)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:169)
	at org.jabref.logic.importer.fetcher.DoiFetcher.performSearchById(DoiFetcher.java:55)
	... 8 more
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at org.jabref.logic.net.URLDownload.openConnection(URLDownload.java:297)
	... 11 more

Could not copy input
java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:152)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:169)
	at org.jabref.logic.importer.fetcher.DoiFetcher.performSearchById(DoiFetcher.java:55)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:47)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:22)
	at javax.swing.SwingWorker$1.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at javax.swing.SwingWorker.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at org.jabref.logic.net.URLDownload.openConnection(URLDownload.java:297)
	... 11 more

Info cannot be found
org.jabref.logic.importer.FetcherException: Invalid URL
	at org.jabref.logic.importer.fetcher.DoiFetcher.performSearchById(DoiFetcher.java:65)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:47)
	at org.jabref.gui.mergeentries.FetchAndMergeWorker.doInBackground(FetchAndMergeWorker.java:22)
	at javax.swing.SwingWorker$1.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at javax.swing.SwingWorker.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:152)
	at org.jabref.logic.net.URLDownload.asString(URLDownload.java:169)
	at org.jabref.logic.importer.fetcher.DoiFetcher.performSearchById(DoiFetcher.java:55)
	... 8 more
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://data.crossref.org/10.1145%2F1496091.1496100
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at org.jabref.logic.net.URLDownload.openConnection(URLDownload.java:297)
	... 11 more

No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().
No localized message exception message defined. Falling back to getMessage().

@tobiasdiez
Copy link
Member

Closed as the other DOI related problems are tracked at #2682.

Siedlerchr added a commit that referenced this issue Mar 25, 2017
* upstream/master:
  Localization: General: French: Translation of new entries
  Localization: Menu: French: Translation of an entry (#2685)
  Fix #2680 and fix #2667: Swing errors are catched properly and without freezing (#2681)
  Do not log AND throw
  Replace misleading error message for fetcher connection error
  Document CrossRef test
  Fix subtitle detection for CrossRef fetcher
  Revert "Invoke LogMessages.add in JavaFX thread"
  Use global user agent
  Update mockito from 2.7.17 to 2.7.18
  Move GuiAppender to GUI package
  Invoke LogMessages.add in JavaFX thread
  [WIP] Put the PDFAnnotationImporter under Test, enhance FileAnnotationTab (#2640)
  Fix for "Paying off technical debt: almost all utility classes have a private constructor now." (#2672)
  Revert "Paying off technical debt: almost all utility classes have a private constructor now. (#2649)" (#2670)
  Paying off technical debt: almost all utility classes have a private constructor now. (#2649)
  Changed codeformatting for better fxml annotation (#2668)
  Disalbe Google Scholar tests on all CI environments (#2654)
  Fix JSONException in Crossref fetcher as mentioned in #2442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs
Projects
None yet
Development

No branches or pull requests

2 participants