Code Monkey home page Code Monkey logo

vavi-speech's Issues

maybe a java bug

old code (after the patch below)

diff --git a/src/main/java/vavi/speech/phonemizer/SudachiJaPhonemizer.java b/src/main/java/vavi/speech/phonemizer/SudachiJaPhonemizer.java
index c0045e2..8314106 100644
--- a/src/main/java/vavi/speech/phonemizer/SudachiJaPhonemizer.java
+++ b/src/main/java/vavi/speech/phonemizer/SudachiJaPhonemizer.java
@@ -38,12 +38,14 @@ public class SudachiJaPhonemizer implements JaPhonemizer {
 
     public SudachiJaPhonemizer() {
         try {
-            Config config = Config.fromClasspath("sudachi.json");
-            Dictionary dict = new DictionaryFactory().create(config);
+        Config config = Config.fromClasspath("sudachi.json");
+        try (
+            Dictionary dict = new DictionaryFactory().create(config)) {
             tokenizer = dict.create();
-            Runtime.getRuntime().addShutdownHook(new Thread(() -> {
-                try { dict.close(); } catch (IOException e) { throw new UncheckedIOException(e); }
-            }));
+//            Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+//                try { dict.close(); } catch (IOException e) { throw new UncheckedIOException(e); }
+//            }));
+            }
         } catch (IOException e) {
             throw new UncheckedIOException(e);
         }

causes crash around java.nio.DirectIntBufferU#get(int).

hs_err_pid92309.log

after the patch above, this program will have a bug that closing dict before using that.

but on catalina the program after the patch works, it contains a bug though.

$ java -version                                                                                                                                                                                                master
java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
nsano@nsanomac3 02:22:08 ~/src/java/vavi-speech2 
$ uname -a                                                                                                                                                                                                     master
Darwin nsanomac3 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64 i386 Darwin

on the other hand, on monterey the program after patch cause crash. java should throw an exception.

$ java -version                                                                                                                                                                                                   0.1.7
java version "1.8.0_341"
Java(TM) SE Runtime Environment (build 1.8.0_341-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)
$ uname -a                                                                                                                                                                                                        0.1.7
Darwin nsanomac4 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:12:57 PDT 2022; root:xnu-8020.240.7~1/RELEASE_X86_64 x86_64

i couldn't create a small sample bug reproducer. because there is no way to create a java.nio.DirectIntBufferU instance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.