digitalmars.D.learn - SegFault with HibernateD
- Venkat (76/76) Jan 11 2018 I get a SegFault with the main method below which uses HibernateD
- Mike Parker (6/13) Jan 11 2018 It says enough to know that the exception is being thrown from
- Rene Zwanenburg (5/19) Jan 12 2018 It looks to me like the program is being run through dub, and dub
- Mike Parker (5/7) Jan 12 2018 I see now. I glossed right over that execution output. On
- Venkat (3/7) Jan 12 2018 Thankyou for the reply. Yes I am running the app on Linux. I
- Venkat (7/9) Jan 12 2018 It fails at the sql() method in Command struct in
- Venkat (19/19) Jan 12 2018 I think there is a bug with PreparedStatement class in
- Venkat (2/2) Jan 12 2018 Sorry about all these posts. Wish there were an edit button. I
- =?UTF-8?Q?Ali_=c3=87ehreli?= (5/6) Jan 12 2018 That's ok. :) These are actually newsgroups (see NNTP protocol).
- Venkat (2/8) Jan 14 2018 Oh! ok, that makes sense. TY.
I get a SegFault with the main method below which uses HibernateD . The second main method which uses ddbc just works fine. What is wrong with the first main method ? I have attached the error at the bottom although I don't think it says much. This method uses HibernateD int main() { // setup DB connection string url = MySQLDriver.generateUrl("localhost", 3306, "test"); string[string] params = MySQLDriver.setUserAndPassword("test", "test"); DataSource ds = new ConnectionPoolDataSourceImpl(new MySQLDriver(), url, params); // create metadata from annotations EntityMetaData schema = new SchemaInfoImpl!(Preferences); // create session factory Dialect dialect = new MySQLDialect(); SessionFactory factory = new SessionFactoryImpl(schema, dialect, ds); scope(exit) factory.close(); auto conn = ds.getConnection(); scope(exit) conn.close(); // create session Session sess = factory.openSession(); scope(exit) sess.close(); Query q = sess.createQuery("select p from Preferences p"); Preferences[] list = q.list!Preferences(); return 0; } The method below uses ddbc. int main(string[] args) { string url = "mysql://localhost:3306/test?user=test,password=test"; // creating Connection auto conn = createConnection(url); scope(exit) conn.close(); // creating Statement auto stmt = conn.createStatement(); scope(exit) stmt.close(); // reading DB auto rs = stmt.executeQuery("SELECT * FROM preferences_wm ORDER BY id"); writeln(rs.getFetchSize()); return 0; } This is the error. Running ./bin/hibernated-test Program exited with code -11 Full exception: object.Exception source/dub/generators/build.d(530): Program exited with code -11 ---------------- /home/vagrant/old-dmd/dmd2/linux/bin64/../../src/phobos/std/exception.d:420 pure safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, const(char[])) [0x8d036c] /home/vagrant/old-dmd/dmd2/linux/bin64/../../src/phobos/std/exception.d:388 pure safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x8defcd] source/dub/generators/build.d:530 void dub.generators.build.BuildGenerator.runTarget(dub.internal.vibeco pat.inet.path.Path, const(dub.compilers.buildsettings.BuildSettings), immutable(char)[][], dub.generators.generator.GeneratorSettings) [0x97b1c9] source/dub/generators/build.d:110 void dub.generators.build.BuildGenerator.performPostGenerateActions(dub.generators.generato .GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[ mmutable(char)[]])) [0x977541] source/dub/generators/generator.d:118 void dub.generators.generator.ProjectGenerator.generate(dub.generators.generato .GeneratorSettings) [0x9805a0] source/dub/dub.d:494 void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) [0x8918e0] source/dub/commandline.d:789 int dub.commandline.GenerateCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) [0x857579] source/dub/commandline.d:821 int dub.commandline.BuildCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) [0x857913] source/dub/commandline.d:849 int dub.commandline.RunCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) [0x857b23] source/dub/commandline.d:239 int dub.commandline.runDubCommandLine(immutable(char)[][]) [0x853647] source/app.d:14 _Dmain [0x84fc27]
Jan 11 2018
On Friday, 12 January 2018 at 05:24:52 UTC, Venkat wrote:I get a SegFault with the main method below which uses HibernateD . The second main method which uses ddbc just works fine. What is wrong with the first main method ? I have attached the error at the bottom although I don't think it says much.This is the error.object.Exception source/dub/generators/build.d(530): ProgramIt says enough to know that the exception is being thrown from dub and not your program. You program is never executed because dub throws the exception before it gets that far. You should report this at the dub repository: https://github.com/dlang/dub/issues
Jan 11 2018
On Friday, 12 January 2018 at 07:33:37 UTC, Mike Parker wrote:On Friday, 12 January 2018 at 05:24:52 UTC, Venkat wrote:It looks to me like the program is being run through dub, and dub is just reporting the program's exit code. Hard to guess what the issue is, I'd attach a debugger to see where it crashes.I get a SegFault with the main method below which uses HibernateD . The second main method which uses ddbc just works fine. What is wrong with the first main method ? I have attached the error at the bottom although I don't think it says much.This is the error.object.Exception source/dub/generators/build.d(530): ProgramIt says enough to know that the exception is being thrown from dub and not your program. You program is never executed because dub throws the exception before it gets that far. You should report this at the dub repository: https://github.com/dlang/dub/issues
Jan 12 2018
On Friday, 12 January 2018 at 08:55:13 UTC, Rene Zwanenburg wrote:It looks to me like the program is being run through dub, and dub is just reporting the program's exit code.I see now. I glossed right over that execution output. On Windows, I don't recall ever seeing a dub exception from dub from a segfault. Just checked by accessing a null pointer and there's nothing thrown from dub. Is that a Linux thing?
Jan 12 2018
On Friday, 12 January 2018 at 12:41:34 UTC, Mike Parker wrote:I see now. I glossed right over that execution output. On Windows, I don't recall ever seeing a dub exception from dub from a segfault. Just checked by accessing a null pointer and there's nothing thrown from dub. Is that a Linux thing?Thankyou for the reply. Yes I am running the app on Linux. I will report the issue.
Jan 12 2018
On Friday, 12 January 2018 at 08:55:13 UTC, Rene Zwanenburg wrote:Hard to guess what the issue is, I'd attach a debugger to see where it crashes.It fails at the sql() method in Command struct in mysql-native-1.1.4/mysql-native/source/mysql/commands.d. This is what gdb says when I do a disp _sql. 1: _sql = <error: Cannot access memory at address 0x8> I'm sorry I am new to systems programming, would that mean _sql is null ?
Jan 12 2018
I think there is a bug with PreparedStatement class in HibernateD. ddbc fails when I use a PreparedStatement. The code below shows that. I will create an issue with HibernateD. int main(string[] args) { string url = "mysql://localhost:3306/webmarx?user=webmarx_dev,password=webm rx"; // creating Connection auto conn = createConnection(url); scope(exit) conn.close(); // creating Statement auto stmt = conn.createStatement(); scope(exit) stmt.close(); PreparedStatement prepStatement = conn.prepareStatement("SELECT * FROM preferences_wm ORDER BY id"); scope(exit) prepStatement.close(); ResultSet rs = prepStatement.executeQuery(); writeln(rs.getFetchSize()); return 0; }
Jan 12 2018
Sorry about all these posts. Wish there were an edit button. I meant PreparedStatement in mysqlddbc driver, not HibernateD.
Jan 12 2018
On 01/12/2018 06:50 PM, Venkat wrote:Sorry about all these posts. Wish there were an edit button.That's ok. :) These are actually newsgroups (see NNTP protocol). Newsgroups don't have any edit functionality. The "forum" is just a web interface to newsgroups. Ali
Jan 12 2018
On Saturday, 13 January 2018 at 06:18:43 UTC, Ali Çehreli wrote:On 01/12/2018 06:50 PM, Venkat wrote:Oh! ok, that makes sense. TY.Sorry about all these posts. Wish there were an edit button.That's ok. :) These are actually newsgroups (see NNTP protocol). Newsgroups don't have any edit functionality. The "forum" is just a web interface to newsgroups. Ali
Jan 14 2018