1. Ralf
  2. Valentina Database ADK
  3. Thursday, October 26 2023, 02:40 PM
  4.  Subscribe via email
Hi, I have database crashes and believe it is due to too many numbers in an IN statement. Is there a maximum amount?
Or can you see the cause in the crash log?


Time Awake Since Boot: 3200000 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007fcb30347ff8
Exception Codes: 0x0000000000000001, 0x00007fcb30347ff8
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [91910]

VM Region Info: 0x7fcb30347ff8 is not in any region. Bytes after previous region: 33423654905 Bytes before following region: 191265775624
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_MEDIUM (reserved) 7fc367800000-7fc368000000 [ 8192K] rw-/rwx SM=NUL ...(unallocated)
---> GAP OF 0x345088a000 BYTES
Stack Guard 7ff7b888a000-7ff7bc08a000 [ 56.0M] ---/rwx SM=NUL

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libvkernel_fat_release_x64.dylib 0x10a8e4907 antlr::TokenBuffer::LT(unsigned int) + 33
1 libvkernel_fat_release_x64.dylib 0x10a6f6396 VSQL_Parser::sql() + 172
2 libvkernel_fat_release_x64.dylib 0x10a7c54a9 fbl::vsql::SqlParser::Parse_UTF8(fbl::vsql::I_SqlDatabaseEx*, char const*, char const*, bool) + 65
3 libvkernel_fat_release_x64.dylib 0x10a7c5c98 fbl::vsql::SqlParser::ParseCommand(fbl::vsql::I_SqlDatabaseEx*, fbl::String const&, fbl::smart_ptr<fbl::ArrayOfSmartPtrs<fbl::smart_ptr<fbl::I_Value> > >, fbl::smart_ptr<fbl::I_Location>, fbl::smart_ptr<fbl::ArrayOfPtrs<fbl::vsql::SqlEnvironment*> >, bool) + 96
4 libvkernel_fat_release_x64.dylib 0x10a7c48b7 fbl::vsql::SqlParser::SqlQuery_(fbl::smart_ptr<fbl::vsql::QueryResult>, fbl::vsql::I_SqlDatabaseEx*, fbl::String const&, fbl::vsql::ECursorLocation, fbl::vsql::ELockType, fbl::vsql::ECursorDirection, fbl::smart_ptr<fbl::ArrayOfSmartPtrs<fbl::smart_ptr<fbl::I_Value> > >, fbl::smart_ptr<fbl::I_Location>;) + 347
5 libvkernel_fat_release_x64.dylib 0x10a7c4e5e fbl::vsql::SqlParser::SqlQuery(fbl::vsql::I_SqlDatabaseEx*, fbl::String const&, fbl::vsql::ECursorLocation, fbl::vsql::ELockType, fbl::vsql::ECursorDirection, fbl::smart_ptr<fbl::ArrayOfSmartPtrs<fbl::smart_ptr<fbl::I_Value> > >;) + 168
6 libvkernel_fat_release_x64.dylib 0x10a5a6452 fbl::vsql::SqlDatabase::SqlQuery(fbl::String const&, fbl::vsql::ECursorLocation, fbl::vsql::ELockType, fbl::vsql::ECursorDirection, fbl::smart_ptr<fbl::ArrayOfSmartPtrs<fbl::smart_ptr<fbl::I_Value> > >;) + 148
7 libvkernel_fat_release_x64.dylib 0x10a5a64bb non-virtual thunk to fbl::vsql::SqlDatabase::SqlQuery(fbl::String const&, fbl::vsql::ECursorLocation, fbl::vsql::ELockType, fbl::vsql::ECursorDirection, fbl::smart_ptr<fbl::ArrayOfSmartPtrs<fbl::smart_ptr<fbl::I_Value> > >;) + 29
8 v4rb_cocoa_64.dylib 0x108016d2f Database_SqlSelect(fbl::smart_ptr<fbl::vsql::I_SqlDatabase>, REALstringStruct*, int, int, int, fbl::smart_ptr<fbl::ArrayOfSmartPtrs<fbl::smart_ptr<fbl::I_Value> > >;) + 133
9 v4rb_cocoa_64.dylib 0x108014c2f Database_SqlSelect_1(REALobjectStruct*, REALstringStruct*, int, int, int) + 253
10 PaluisServer 0x103b20636 VDatabase.SqlSelect%o<VCursor>%o<VDatabase>si8i8i8 + 102
...
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Ralf,

Could you please add a query that causes this crash?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 1
Ralf Accepted Answer
It is the following query, but with 2495 values in the "IN ()".

Select Distinct mAufNR, DeType From Dateneingang Where mAufNR in (155340,155344,155472,155520,155529,155539,155542,155543,155544,155548,155562,155563,155605,155630,155650,155660,155679,155680,155681,155682,155683,155684,155685,155686,155687,155688,155689,155691,155692,155693,155698,155699,155700,155701,155702,155703,155704,155705,155706,155708,155709,155710,155711,155712,155716,155717,155741,155743,155749,155751,155773,155775,155777,155797,155835,155839,155858,155871,155895,155898,155903,155907,155912,155930,155962,155967,155975,155979,156011,156029,156106,156125,156183,156190,156204,156231,156265,156266,156269,156276,156301,156320,156361,156364,157060,157061,157072,157082,157100,157107,157116,157125,157127,157152,157171,157173,157175,157178,157223,157224,157227,157235,157266,157331,157385,157386,157397,157468,157477,157481,157499,157536,157563,157578,157581,157624,157626,157658,157662,157682,157683,157685,157691,157749,157752,157757,157806,157808,157835,157837,157848,157870,157880,157884,157889,157892,157920,157930,157946,157968,157972,157976,157977,157996,157998,158011,158012,158016,158022,158024,158026,158027,158032,158033,158034,158039,158053,158058,158066,158067,158079,158081,158106,158115,158116,158120,158122,158127,158135,158136,158164,158177,158179,158181,158182,158184,158187,158188,158189,158193,158194,158202,158203,158211,158223,158226,158227,158229,158233,158234,158235,158243,158247,158250,158251,158252,158254,158257,158262,158264,158266,158268,158269,158273,158275,158282,158287,158288,158296,158297,158299,158317,158323,158326,158346,158364,158365,158366,158370,158376,158377,158381,158383,158385,158386,158389,158392,158393,158398,158401,158402,158405,158406,158407,158408,158409,158411,158412,158415,158417,158418,158420,158442,158471,158476,158478,158480,158482,158485,158487,158491,158494,158495,158497,158498,158499,158500,158504,158506,158510,158511,158513,158514,158515,158516,158517,158518,158519,158520,158523,158524,158525,158527,158528,158530,158535,158536,158538,158542,158546,158547,158549,158556,158557,158558,158559,158561,158562,158563,158564,158565,158573,158574,158580,158581,158583,158584,158587,158588,158599,158610,158618,158620,158623,158625,158626,158627,158628,158630,158631,158633,158634,158639,158640,158641,158642,158645,158649,158650,158651,158660,158661,158663,158665,158666,158668,158670,158672,158673,158678,158679,158681,158684,158685,158686,158687,158688,158689,158690,158691,158692,158693,158694,158696,158699,158700,158701,158705,158707,158710,158712,158714,158715,158718,158720,158721,158723,158724,158732,158733,158735,158736,158737,158741,158742,158743,158745,158746,158750,158752,158759,158760,158763,158768,158769,158771,158775,158776,158778,158779,158780,158781,158782,158783,158784,158787,158788,158789,158790,158791,158792,158793,158794,158799,158803,158804,158805,158807,158808,158809,158811,158812,158813,158814,158815,158816,158817,158818,158819,158820,158821,158824,158825,158826,158831,158832,158835,158838,158839,158840,158841,158842,158843,158844,158845,158847,158851,158852,158855,158856,158857,158858,158859,158860,158861,158862,158865,158867,158869,158870,158871,158872,158873,158875,158876,158877,158878,158880,158881,158882,158883,158885,158886,158887,158888,158889,158890,158891,158893,158894,158895,158899,158902,158904,158905,158907,158909,158910,158911,158912,158913,158915,158916,158917,158918,158924,158925,158926,158927,158928,158930,158931,158932,158933,158934,158935,158937,158938,158939,158940,158941,158942,158944,158945,158946,158947,158949,158950,158951,158954,158955,158957,158958,158960,158961,158962,158963,158964,158965,158966,158967,158968,158969,158970,158971,158972,158973,158976,158977,158979,158981,158982,158983,158984,158985,158986,158988,158989,158990,158991,158992,158993,158994,158999,159000,159002,159003,159004,159005,159006,159009,159010,159011,159013,159014,159015,159016,159017,159018,159019,159020,159022,159023,159025,159026,159027,159028,159029,159030,159033,159034,159035,159037,159039,159040,159041,159042,159044,159045,159046,159047,159049,159052,159053,159054,159055,159056,159063,159064,159065,159066,159067,159068,159069,159070,159071,159072,159073,159077,159078,159081,159082,159083,159084,159085,159086,159087,159088,159089,159091,159092,159094,159095,159096,159097,159098,159099,159100,159101,159102,159103,159104,159105,159106,159107,159112,159115,159116,159118,159120,159121,159122,159123,159124,159125,159126,159127,159128,159129,159130,159131,159132,159134,159135,159136,159138,159139,159140,159141,159142,159143,159144,159145,159146,159147,159148,159153,159155,159156,159159,159160,159161,159163,159164,159165,159169,159170,159171,159173,159174,159175,159176,159177,159179,159180,159182,159184,159185,159187,159188,159189,159190,159191,159192,159193,159195,159196,159198,159199,159200,159201,159202,159203,159204,159205,159206,159208,159209,159210,159211,159212,159213,159214,159215,159216,159217,159218,159219,159220,159221,159222,159223,159224,159225,159226,159227,159228,159229,159230,159231,159240,159241,159242,159243,159253,159254,159255)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 2
Ivan Smahin Accepted Answer
Hi Ralf,

I can not reproduce this "lengthy IN" issue. Moreover, I made it much bigger, and everything works fine.
You may check it yourself using Valentina Studio.

So, obviously, we have deal with some memory corruption in your app, and this crash is just a consequence.
Could you send me some simple app to reproduce the crash?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 3
Ivan Smahin Accepted Answer
Anyway, such a lengthy query could be slow.
Probably you should consider using some (tmp) table for that IN's values, and your query will be something like this one:

Select Distinct mAufNR, DeType From Dateneingang Where mAufNR in (SELECT f1 FROM tmpTbl)


or inner join for Dateneingang and that tmpTbl:
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 4
Ralf Accepted Answer
Hello Ivan,
thanks for the tip with the Temp Table. I will have a look at it. At the moment I split the IN query.

(mAufNR in (...) or mAufNR in (...) or mAufNR in (...))
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 5
Ivan Smahin Accepted Answer
But I'm still curious - does it work exactly "problematic" query in vStudio or also crashed?
Could you try it please?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 6
Ralf Accepted Answer
Yesterday I had adjusted the app so that no IN query with more than 2000 entries occur. Since then there has been no crash. But this is only a temporary solution.
On a M1 Max Macbook Pro I could not reproduce the problem even with 4000 entries. The crashes occurred on a 2018 Mac mini with 6-core Intel i5 and Monterey 12.6.8.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 7
Ivan Smahin Accepted Answer
I have played with up to 50,000,000 entries (M1 Air). It was slow, but works.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 8
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.