JWNL hangs during multithreaded processing

Help
2009-03-18
2013-04-29
  • Andra Willits

    Andra Willits - 2009-03-18

    I am running JWNL 1.3 in an application that uses GATE for linguistic analysis.  The application uses a queue to line up strings to be processed.  Each string is popped off the queue and pulls an instance of ANNIE (Gate plugin that contains linguistic processing tools) out of a Pool.  The JWNL itself is initialized once during server start up and then the Dictionary instance is used several times throughout the application.

    The problem that I am having is at the line:
    IndexWord iw = dictionary.lookupIndexWord(
                                    POS.NOUN, word);

    It works fine through processing of each string when there is only a single thread running but as soon as I increase to 2 threads, this line will hang on random strings.  It doesn't appear to be a problem with the data as in some runs, it is able to process a particular word fine and in others, it doesn't.

    Could anyone tell me if there are issues with running JWNL in a multithreaded application?  I did try initializing the JWNL in each thread separately but this produced the same results.

    I can provide additional information if that would help as well.

    Thank you in advance.

     
    • Brett Walenz

      Brett Walenz - 2009-03-31

      Yes, I believe this will cause problems, as JWNL was never original designed to be operated in enterprise environments.  I don't think initializing JWNL in it's own thread would have any effect, as Dictionary is a singleton object.

      It's on the list of 'things to do' for a future release, but requires some architecture changes.

       
    • Vanessa Lopez

      Vanessa Lopez - 2009-07-01

      I do have the same problem too.
      I have tried to use locks while calling WordNet but it fails half of the times ..

      Looking forward for the future release

       
  • Aliaksandr Autayeu

    In my fork at http://extjwnl.sourceforge.net/ you can use the dictionary in a normal way, instance per thread, as opposed to the only one singletone instance. This might help resolving threading problems.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks