mysql-native + vibe.d example

crimaniak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 29 17:52:28 PDT 2017


Hi!
Moving my project from mysql-lited to mysql-native I faced the 
problem with null pointer error inside of mysql-native:

Log:
SELECT id FROM versionupdate ORDER BY id
Task terminated with unhandled exception:
etc.linux.memoryerror.NullPointerError at src/etc/linux/memoryerror.d(325)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) 
[0x102ebad]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x102eaee]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:466 const(pure nothrow @property bool function()) mysql.result.ResultRange.isValid [0xdf1626]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:536 void mysql.result.ResultRange.close() [0xdf1cb8]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:460 void mysql.result.ResultRange.__dtor() [0xdf15cc]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:430 ref return mysql.result.ResultRange mysql.result.ResultRange.opAssign(mysql.result.ResultRange) [0xdf1dba]
source/vcm/sqlWrapper.d:63 mysql.result.ResultRange 
vcm.sqlWrapper.SqlWrapper.query!().query(immutable(char)[]) 
[0xdd57e3]
source/updater/manager.d:92 void 
updater.manager.UpdateManager.update() [0xd74886]
source/app.d:81 void app.prepareDb().__lambda1() [0xcfe740]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/core/core.d:595 void vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) [0xc5b703]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/core/core.d:1224 void vibe.core.core.CoreTask.run() [0xf6a916]
??:? void core.thread.Fiber.run() [0x107f17b]
??:? fiber_entryPoint [0x107eede]
??:? [0xffffffff]

Code fragment:
		string s = Sql(sqlString, args).toString!MysqlDialect;
		writeln(s);stdout.flush; // debugging...

		if(conn.__conn() is null) // debugging...
			throw new Exception("connection is null");
		
		ResultRange result;
		// synchronized (mutex)
			result = conn.query(s);  // <-- sqlWrapper.d:63 is here

It seems I am doing something wrong so myself-native fails to 
detect it in isValid(). So I search for example how to use 
mysql-native in real multi-threaded vibe.d application with usage 
of MySQLPool. Please do not point me to basic example provided 
with package because it is single thread.
Thanks.



More information about the Digitalmars-d-learn mailing list