Menu

#315 Import binary file causes hang

None
open
nobody
Core (462)
5
2018-12-22
2005-11-25
Rob Manning
No

Using the contents editor do the following on a table
with a blob:

1. insert a new row (with null value for blob)
2. double-click the blob cell in the new row to
access the PopupEditableIOPanel.
3. Click browse and load the Jakarta Pitfalls PDF file
(see
http://squirrel-sql.sourceforge.net/downloads/JakartaPitfallsChapter1.pdf\)
4. Click Import - watch SQuirreL hang irrecoverably

When I attached a remote debugger and suspended the
AWT-Event thread I see the following stack trace which
seems to indicate where it was stuck transferring data:

Thread [AWT-EventQueue-1] (Suspended)
GapContent.getChars(int, int, Segment) line: not available
PlainDocument(AbstractDocument).getText(int, int,
Segment) line: not available
WrappedPlainView.loadText(Segment, int, int) line: not
available
WrappedPlainView.calculateBreakPosition(int, int)
line: not available
WrappedPlainView$WrappedLine.calculateLineCount()
line: not available
WrappedPlainView$WrappedLine.insertUpdate(DocumentEvent,
Shape, ViewFactory) line: not available
WrappedPlainView.insertUpdate(DocumentEvent, Shape,
ViewFactory) line: not available
BasicTextUI$RootView.insertUpdate(DocumentEvent,
Shape, ViewFactory) line: not available
BasicTextUI$UpdateHandler.insertUpdate(DocumentEvent)
line: not available
PlainDocument(AbstractDocument).fireInsertUpdate(DocumentEvent)
line: not available
PlainDocument(AbstractDocument).handleInsertString(int,
String, AttributeSet) line: not available
PlainDocument(AbstractDocument).insertString(int,
String, AttributeSet) line: not available
PlainDocument.insertString(int, String, AttributeSet)
line: not available
PlainDocument(AbstractDocument).replace(int, int,
String, AttributeSet) line: not available
RestorableJTextArea(JTextComponent).setText(String)
line: not available
RestorableJTextArea.updateText(String) line: 42
PopupEditableIOPanel.importData(File) line: 777
PopupEditableIOPanel.actionPerformed(ActionEvent)
line: 436
JButton(AbstractButton).fireActionPerformed(ActionEvent)
line: not available
AbstractButton$Handler.actionPerformed(ActionEvent)
line: not available
DefaultButtonModel.fireActionPerformed(ActionEvent)
line: not available
DefaultButtonModel.setPressed(boolean) line: not available
BasicButtonListener.mouseReleased(MouseEvent) line:
not available
JButton(Component).processMouseEvent(MouseEvent) line:
not available
JButton(JComponent).processMouseEvent(MouseEvent)
line: not available
JButton(Component).processEvent(AWTEvent) line: not
available
JButton(Container).processEvent(AWTEvent) line: not
available
JButton(Component).dispatchEventImpl(AWTEvent) line:
not available
JButton(Container).dispatchEventImpl(AWTEvent) line:
not available
JButton(Component).dispatchEvent(AWTEvent) line: not
available
LightweightDispatcher.retargetMouseEvent(Component,
int, MouseEvent) line: not available
LightweightDispatcher.processMouseEvent(MouseEvent)
line: not available
LightweightDispatcher.dispatchEvent(AWTEvent) line:
not available
MainFrame(Container).dispatchEventImpl(AWTEvent) line:
not available
MainFrame(Window).dispatchEventImpl(AWTEvent) line:
not available
MainFrame(Component).dispatchEvent(AWTEvent) line: not
available
Application$1(EventQueue).dispatchEvent(AWTEvent)
line: not available
Application$1.dispatchEvent(AWTEvent) line: 172
EventDispatchThread.pumpOneEventForHierarchy(int,
Component) line: not available
EventDispatchThread.pumpEventsForHierarchy(int,
Conditional, Component) line: not available
EventDispatchThread.pumpEvents(int, Conditional) line:
not available
EventDispatchThread.pumpEvents(Conditional) line: not
available
EventDispatchThread.run() line: not available

Discussion

  • Colin Bell

    Colin Bell - 2006-10-31
    • assigned_to: colbell --> manningr
     
  • Colin Bell

    Colin Bell - 2006-10-31

    Logged In: YES
    user_id=233132

    Rob,

    is this still a problem?

     
  • Rob Manning

    Rob Manning - 2006-11-02
     
  • Rob Manning

    Rob Manning - 2006-11-02

    Logged In: YES
    user_id=1287991

    Colin,

    I just tried it again and the results were inconclusive.
    There is definitely still a problem with PDFs as
    I tried a different one that was only 119KB and SQuirreL is
    hung. However, it had not problem
    whatsoever importing a 20K jpeg file. I think some more
    testing is in order to see if it's something
    about PDFs or file size. Attached is the pdf file that
    causes SQuirrel to hang.

    Rob

     
  • Rob Manning

    Rob Manning - 2006-11-02

    Logged In: YES
    user_id=1287991

    Colin,

    After further tests it appears my original report wasn't
    exactly accurate. The "hang" that I noticed, was
    actually the event thread processing some really slow code
    often (GapContent.getChars). I don't know what
    it is about PDFs (or maybe 100+ KB files) but if I resize
    the window so that the import dialog is no longer
    showing, SQuirreL eventually finishes repainting. In fact,
    if I resize it a little at a time, eventually
    I can get the import dialog to repaint showing the binary
    hex of the pdf file that was read. And when I
    click "Update Data" it appears to correctly update the row.
    So, maybe it's just a matter of using a different
    algorithm for rendering the binary content or somehow
    offloading some of the work off of the event thread.
    In any case, the GapContent.getChars method seems to be
    called many times each time the dialog is repainted.
    I'm glad I had a chance to further characterize the problem
    - it's not a "hang" problem, but a UI responsiveness problem
    masquerading as one.

    Rob

     
  • Colin Bell

    Colin Bell - 2006-11-02

    Logged In: YES
    user_id=233132

    You're right it definitely the painting of the text control
    causing the problem. In the case of your 119K PDF when
    converted to the hex representation its 484344 bytes long.

    It just takes a Swing JTextArea a long time to render that
    data. Scrolling it once dispalyed also takes a long time. I
    think the solution to this will be to replace the control
    with something that is smarter about large pieces of text.
    Possibly the Netbeans control.

     
  • Rob Manning

    Rob Manning - 2007-04-03
    • assigned_to: manningr --> nobody
     
  • Rob Manning

    Rob Manning - 2007-04-03

    Logged In: YES
    user_id=1287991
    Originator: YES

    Both of these bugs have something in common:

    1686698 (Opening large textfile consumes huge amout of memory)

    1366016 (Import binary file causes hang)

    They both are caused by many calls to methods in GapContent
    as a result of loading data or reading data into/from a JTextArea.

    1366016: GapContent.getChars
    1686698: GapContent.insertString

    We would do well to reduce the dependence on this Java API implementation
    class or remove it from the call chain entirely (but how?).

    Rob

     

Log in to post a comment.