Segmentation fault with the ruby connection_adapter

171 views
Skip to first unread message

mikelb

unread,
Sep 20, 2010, 9:24:10 PM9/20/10
to SQL Anywhere Web Development
Hi! After I load the environment, when I go to load a page, I'm
getting the following:

2010/09/20 19:21:27 Killed server with pid: 18588
2010/09/20 19:21:27 Start debugger
Fast Debugger (ruby-debug-ide 0.4.10) listens on :39767
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-09-20 19:21:31] INFO WEBrick 1.3.1
[2010-09-20 19:21:31] INFO ruby 1.8.7 (2010-01-10) [x86_64-linux]
[2010-09-20 19:21:36] INFO WEBrick::HTTPServer#start: pid=18637
port=3000
/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/
active_record/connection_adapters/sqlanywhere_adapter.rb:266: [BUG]
Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]



Any help would be MUCH appreciated!

Thanks!

mikelb

unread,
Sep 21, 2010, 1:46:46 AM9/21/10
to SQL Anywhere Web Development
Somehow I got this figured out... but now I have a new one. Here it
is (PLEASE help if you can!!!!) Thank you!:


NoMemoryError (failed to allocate memory):
/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/
active_record/connection_adapters/sqlanywhere_adapter.rb:267:in
`sqlany_get_column'
/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/
active_record/connection_adapters/sqlanywhere_adapter.rb:267:in
`execute_without_analyzer'
/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/
active_record/connection_adapters/sqlanywhere_adapter.rb:265:in
`times'
/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/
active_record/connection_adapters/sqlanywhere_adapter.rb:265:in
`execute_without_analyzer'
vendor/plugins/rails-footnotes/lib/rails-footnotes/notes/
queries_note.rb:152:in `execute'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
vendor/plugins/rails-footnotes/lib/rails-footnotes/notes/
queries_note.rb:152:in `execute'
/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/
active_record/connection_adapters/sqlanywhere_adapter.rb:457:in
`select'
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/database_statements.rb:7:in `select_all_without_query_cache'
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/query_cache.rb:60:in `select_all'
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/query_cache.rb:81:in `cache_sql'
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/query_cache.rb:60:in `select_all'
vendor/rails/activerecord/lib/active_record/base.rb:664:in
`find_by_sql'
vendor/rails/activerecord/lib/active_record/base.rb:1578:in
`find_every'
vendor/rails/activerecord/lib/active_record/base.rb:1535:in
`find_initial'
vendor/rails/activerecord/lib/active_record/base.rb:616:in `find'
vendor/plugins/aasm/lib/aasm/persistence/
active_record_persistence.rb:95:in `find_in_state'
vendor/plugins/aasm/lib/aasm/persistence/
active_record_persistence.rb:114:in `with_state_scope'
vendor/rails/activerecord/lib/active_record/base.rb:2178:in
`with_scope'
vendor/plugins/aasm/lib/aasm/persistence/
active_record_persistence.rb:113:in `with_state_scope'
vendor/plugins/aasm/lib/aasm/persistence/
active_record_persistence.rb:94:in `find_in_state'
app/models/user.rb:63:in `authenticate'
app/controllers/sessions_controller.rb:11:in `create'
vendor/rails/actionpack/lib/action_controller/base.rb:1331:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:1331:in
`perform_action_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:617:in
`call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:610:in
`perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:
17:in `ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:
17:in `ms'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in
`perform_action_without_flash'
vendor/rails/actionpack/lib/action_controller/flash.rb:151:in
`perform_action_without_render_component'
vendor/plugins/render_component/lib/components.rb:39:in
`perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:532:in
`process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:606:in
`process'
vendor/rails/actionpack/lib/action_controller/base.rb:391:in
`process'
vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:
438:in `call'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in
`dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in
`_call'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in
`call'
vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in
`call'
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/query_cache.rb:34:in `cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in
`cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in
`call'
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/connection_pool.rb:361:in `call'
vendor/rails/actionpack/lib/action_controller/string_coercion.rb:
25:in `call'
rack (1.1.0) lib/rack/head.rb:9:in `call'
rack (1.1.0) lib/rack/methodoverride.rb:24:in `call'
vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in
`call'
vendor/rails/actionpack/lib/action_controller/session/
cookie_store.rb:99:in `call'
vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in
`call'
rack (1.1.0) lib/rack/lock.rb:11:in `call'
rack (1.1.0) lib/rack/lock.rb:11:in `synchronize'
rack (1.1.0) lib/rack/lock.rb:11:in `call'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in
`call'
vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in
`run'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in
`call'
vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
rack (1.1.0) lib/rack/urlmap.rb:47:in `call'
rack (1.1.0) lib/rack/urlmap.rb:41:in `each'
rack (1.1.0) lib/rack/urlmap.rb:41:in `call'
vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.1.0) lib/rack/content_length.rb:13:in `call'
rack (1.1.0) lib/rack/chunked.rb:15:in `call'
rack (1.1.0) lib/rack/handler/mongrel.rb:67:in `process'
mongrel (1.1.5) lib/mongrel.rb:159:in `process_client'
mongrel (1.1.5) lib/mongrel.rb:158:in `each'
mongrel (1.1.5) lib/mongrel.rb:158:in `process_client'
mongrel (1.1.5) lib/mongrel.rb:285:in `run'
mongrel (1.1.5) lib/mongrel.rb:285:in `initialize'
mongrel (1.1.5) lib/mongrel.rb:285:in `new'
mongrel (1.1.5) lib/mongrel.rb:285:in `run'
mongrel (1.1.5) lib/mongrel.rb:268:in `initialize'
mongrel (1.1.5) lib/mongrel.rb:268:in `new'
mongrel (1.1.5) lib/mongrel.rb:268:in `run'
rack (1.1.0) lib/rack/handler/mongrel.rb:38:in `run'
vendor/rails/railties/lib/commands/server.rb:111
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/script/server:3
/var/lib/gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:
109:in `debug_load'
/var/lib/gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:
109:in `debug_program'
/var/lib/gems/1.8/gems/ruby-debug-ide-0.4.9/bin/rdebug-ide:87
/home/merlin/.gem/ruby/1.8/bin/rdebug-ide:19:in `load'
/home/merlin/.gem/ruby/1.8/bin/rdebug-ide:19

Rendered rescues/_trace (53.4ms)
Rendered rescues/_request_and_response (1.3ms)
Rendering rescues/layout (internal_server_error)

mikelb

unread,
Sep 21, 2010, 2:38:40 AM9/21/10
to SQL Anywhere Web Development
Actually.... where it says line 267, it should be 266... just to let
you know. Thanks.

Eric Farrar

unread,
Sep 21, 2010, 9:52:33 AM9/21/10
to SQL Anywhere Web Development
Can you tell me what you did to stop the Segmentation Fault you were
originally seeing in the first post?

The exception, NoMemoryError, is thrown from a deeper layer than the
SQL Anywhere adapter. It would seem that it is being thrown when the
adapter is asking Ruby to allocate the memory to pull back a result
set and turn it into an object. What query are you running that is
causing this error to appear? It is possible it is returning thousands
or millions of rows that would be causing it to run out of memory?

The ActiveRecord query model works a bit differently from most other
database APIs. In most other database APIs you can perform queries
that return huge result sets because you use a cursor to walk through
the results, so the results do not all have to fit into memory at the
same time. ActiveRecord, following its Object-Relational Mapper
abstraction, will pull the entire result set into memory and return it
as a Ruby object. There is no way to do regular cursor interaction
(only holding the current row in memory) in ActiveRecord. This is one
of the drawbacks of ActiveRecord.

Michael Bahnmiller

unread,
Sep 21, 2010, 9:54:46 AM9/21/10
to sql-anywhere-w...@googlegroups.com
Hey, Eric! :)

I actually don't remember what I did to stop the SegFault.

BUT... let's talk about the NoMemoryError. I get this even if I do the
following in a consolse:

u = User.first

So, even if I'm asking for a single record, I get the error.

Any thoughts?

Eric Farrar

unread,
Sep 21, 2010, 10:01:16 AM9/21/10
to SQL Anywhere Web Development
Could you tell me your machine specs? (OS, amount of memory, version
of SQL Anywhere, version of Rails)

Thanks,

- Eric

On Sep 21, 9:54 am, Michael Bahnmiller <songsofdistantea...@gmail.com>
wrote:

Eric Farrar

unread,
Sep 21, 2010, 10:02:31 AM9/21/10
to SQL Anywhere Web Development
Another question: Does it show up consistently and right after start
up, or does it show up at seemingly random times after it has been
running for a while?
> > >>>  ...
>
> read more »

Michael Bahnmiller

unread,
Sep 21, 2010, 1:09:01 PM9/21/10
to sql-anywhere-w...@googlegroups.com
OS: Kubuntu 10.04, Memory 6GB DDR3 1333, SQLAnywhere 11.0, Rails 2.3.8...

Near as I can tell, it's the same setup as my Desktop (as far as
software), but with better hardware. This works on my Desktop, but not
on the laptop.

Michael Bahnmiller

unread,
Sep 21, 2010, 1:10:14 PM9/21/10
to sql-anywhere-w...@googlegroups.com
It's very consistent. It happens *any* time I try to do any kind of
select query. (I haven't tried any other queries, such as update or
anything, but can't really do that with activerecord until I have an
object! ... (it happens even with User.new))

Thanks, Eric!
Michael

>> read more �
>>
>

Eric Farrar

unread,
Sep 21, 2010, 1:37:05 PM9/21/10
to SQL Anywhere Web Development
Could you try an ActiveRecord query that uses a SQLite, PostgreSQL, or
MySQL backend and see if it works?

I just want to rule out the possibility that it is a Rails/
ActiveRecord/Ruby bug with the specific hardware since it appears that
the exception is thrown from a deeper than the activerecord-
sqlanywhere-adapter.

Thanks,

- Eric

On Sep 21, 1:10 pm, Michael Bahnmiller <songsofdistantea...@gmail.com>
wrote:
> >>>>>>     mongrel (1.1.5)...
>
> read more »

Michael Bahnmiller

unread,
Sep 21, 2010, 3:28:32 PM9/21/10
to sql-anywhere-w...@googlegroups.com
It turns out, yes, I *can* pull up records with the MySQL adapter.

Thanks, Eric.

What next?

Michael

>> read more �
>>
>

Michael Bahnmiller

unread,
Sep 21, 2010, 3:41:42 PM9/21/10
to sql-anywhere-w...@googlegroups.com
Do you think maybe I should upgrade to the 11.0.1 from the 11.0? (if
so, how does one upgrade?)

Thanks,
Michael

On 09/21/2010 11:37 AM, Eric Farrar wrote:

>> read more �
>>
>

Michael Bahnmiller

unread,
Sep 21, 2010, 8:29:59 PM9/21/10
to sql-anywhere-w...@googlegroups.com
Eric. I got it figured out. I was trying to install 11.0.1, but for
some reason it would just install over the top of 11.0.0.? ... BUT, it
wouldn't change versions... it was weird....

So I deleted all directories related to SQLAnywhere, and then just
transfered my directories over from my desktop. (Also had to manually
set up the symlinks.)

But... shazam! Looks like we're in business.

Thanks for helping me think through this!

Michael

On 09/21/2010 11:37 AM, Eric Farrar wrote:

>> read more �
>>
>

Eric Farrar

unread,
Sep 22, 2010, 9:36:17 AM9/22/10
to SQL Anywhere Web Development
Hey Michael,

Glad you got it sorted out. It would have been nice to figure out
exactly what the problem is (both with the NoMemory Error and the
install), but I am glad it is working.

Let me know if you run into any more issues.

- Eric

On Sep 21, 8:29 pm, Michael Bahnmiller <songsofdistantea...@gmail.com>
> >>>>>>>> 25:in...
>
> read more »

Michael Bahnmiller

unread,
Sep 22, 2010, 9:39:19 AM9/22/10
to sql-anywhere-w...@googlegroups.com
Heh, Thanks Eric.

I agree. Knowing is always better.

But I'll settle for "working" at this point. :D

Thanks, again.

Michael

>> read more �
>>
>

Reply all
Reply to author
Forward
0 new messages