Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Dec 2011 at 22:13 UTC
Updated:
13 Nov 2014 at 13:33 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dgastudio commentedsame here.
Comment #2
geerlingguy commentedAlso had this crop up, but only for some users (when saving their profiles).
Comment #3
geerlingguy commentedIt looks like the problem is that entity cache only sets up tables for entities that existed before the installation of the entitycache module itself (see the implementation of
hook_schema()in entitycache.install). Therefore, if you first install the entitycache module, then later install something that creates a new entity, like Profile2, that entity's cache table will never be created.After testing an uninstall and reinstall, it looks like the cache_entity_profile2 table was still not created; it looks like there's no code to automatically create extra entity tables, but rather it seems each module that supports entity cache would need to build it's own cache table/bin? (From this module's page: "Create a cache_entity_$myentity table/bin.").
In any case, you can manually create the table using db_create_table():
Perhaps this should be moved to the Profile2 issue queue?
Comment #4
geerlingguy commentedComment #5
geerlingguy commentedComment #6
webflo commentedYep this is an Profile 2 issue.
Comment #7
webflo commentedComment #8
erikwebb commentedSame issue here. I've actually enabled Entity Cache after Profile2. I see all of the SET commands sent to Memcached on every page load, but no GET commands are ever executed.
Comment #9
nielsonm commentedI created a patch for this based off of @geerlingguy's comment #3 I added the entity cache to the install file. Let me know if this works, or if there's a better way.
Thanks,
Nielsonm
Comment #10
geerlingguy commentedComment #11
TimelessDomain commentedI tried the patch + ran cron/updates & flushed cache, but no difference. Is this patch only for new installs?
I did get it to work finally by adding this to the bottom profile2.install
Comment #12
nielsonm commentedIn order for the patch to work, you would have needed to uninstall and re-install the module, as hook_install only gets called during installation. An update hook would work if uninstalling the module is unacceptable.
Comment #13
stopshinal commentedAfter you added this, what did you do to make it work? I've run cron, flushed again, I'm still getting this error. I suppose i'm unsure how to run the update
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pantheon.cache_entity_profile2' doesn't exist: DELETE FROM {cache_entity_profile2} WHERE (cid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 4 ) in cache_clear_all() (line 169 of /includes/cache.inc).
Comment #14
visualfox commented@stopshinal You need to call update.php to have this patch working
Comment #15
stopshinal commentedMental blank, thanks!
Comment #16
fagohm, I'm not very happy with having to do this in each entity-providing module in order to support entity-cache. It would also mean we'd end up with lots of unused cache tables if entitycache isn't used.
I'd prefer a solution where we handle the cache tables in or triggered by entitycache.
Comment #17
alexweber commented@fago, in this case, the issue should be in the EntityCache queue and not Profile2!
I agree, entitycache should check what entities enable cache option and handle creating and deleting the necessary tables itself.
Comment #18
geerlingguy commentedWell, it was in the EntityCache queue, and was shuffled over here... we could bounce it back, give it a fancy new title, and hope the EntityCache maintainers would find a way to make it work, maybe by defining a list of modules they'd support... but it's kind a chicken-and-egg problem, since they don't want to maintain a list of modules that provide entities, and entity module maintainers don't want to provide support for EntityCache :-/
Comment #19
alexweber commented@geerlingguy I completely understand, however, entitycache support is determined by whether or not the "entity cache" option is passed in hook_entity_info(). Therefore, all they really would have to do is, before writing or reading from cache, check if the table exists and, if not, create it. It's quite simple IMO :)
Comment #20
Pascal.s commentedI wanted to install de patch but i already had lots of fields configured and didn't want to lose that! (or maybe i did it wrong)
But #11 did it for me!
So as far as i'm concerned for now... For me, it's fixed!
Comment #21
alexweber commentedPlease don't change the title to something meaningless, it will throw people off that are looking for the same solution to your problem!
Comment #22
havran commentedFor my needs i create this patch which cover creating table by update.php.
Comment #23
EvanDonovan commented@havran: Looks like a good approach, although fago had said earlier he'd prefer not to do it. Perhaps if the update was wrapped in
if(module_exists('entitycache')?Also, can you post as an actual patch?
Comment #24
erikwebb commented@EvanDonovan: Based on fago's previous comments, it actually sounds like the right implementation would be to add a hook to Entity Cache that can be easily implemented by each entity-providing module. This would be much more repeatable and easy to manage.
Comment #25
EvanDonovan commentedIs there an issue for that currently?
Comment #26
puddyglumThis fixed a problem where we could not Cancel user accounts.
I applied both #9 and #11, and after running update.php everything works fine.
Comment #27
hejazee commented#9 and #11 work fine
Comment #28
TimelessDomain commentedComment #29
raulmuroc commentedI appplied the patches first because I saw the same error at the topic and It solved that. A few weeks later I ntoiced that the thing was that Entity cache breaks Profile2 so I uninstalled Entity cache. After a few crons profile2 fields disappear (not other fields types) and I think is because of this process: 1) Apply patches. 2) Uninstall entity cache.
What is to do with:
IT created the table. After I uninstall "Entity Cache" all the profile2 fields (ones created before the patch and even the news after the patch) just do not appear.
:(
Comment #30
tim.plunkettEntity cache's module page explicitly states: "There is no automated support for contrib entities, to use entitycache for a contrib or custom entity: Create a cache_entity_$myentity table/bin."
So I don't think catch plans to change that, and this is a relatively major bug.
Here's an updated patch with the hook_update_N(), but with a db_table_exists() check first.
Comment #31
kingdutchI applied the patch in #30 manually (didn't have a git clone lying around) to the current stable version and tried to update but update.php tells me no updates, even after manually bumping the version number and packaging timestamp (perhaps I'm doing something wrong).
Also this patch does not address the issue in #16 about a lot of empty tables in the case entity_cache is not used.
Comment #32
Vale80 commentedHello everyone!
Could you please summarize which is the best solution to fix it for good?
#9 and #11 OR #30 ?
Thanks in advance!
Comment #33
infines commented#30 is currently the most updated patch.
And it worked wonderfully for me.
Comment #34
Vale80 commentedThanks gridbitlabs!
Comment #35
Vale80 commentedI'm new in Drupal, I search around but I can't understand which is the right procedure to apply this patch.
Could you please point me out some urls?
In the Applying a patch Profile2 section, it says:
Download the patch to your working directory. Apply the patch with the following command:
git apply -v [patchname.patch]
Could you please tell me which is my working directory?
And how can I run that command?
The Drupal installation where I want to apply this patch is on a server, is a test site.
Thanks again!
Comment #36
infines commentedPlease refer to the IRC support channel or the forums for questions like this. This is an issue queue and we need to keep the focus on track. There are many ways to apply a patch. You can read about them here: http://drupal.org/patch/apply
Comment #37
btopro commentedpatch worked for me. that's multiple confirmed cases of working (I had it work on 3 different installs), is this RTBC?
Comment #38
infines commented@btopro While the patch fixes the error, there were other issues addressed in comment #31 that need to be taken care of or resolved elsewhere. These decisions are partly up to the maintainer.
Comment #39
dawehnerSure there is a small problem when there is an empty table, but let's be honest: Which site using profile2 and does not use entitycache have actual problems when they have one single unused table. In general each big site will have to use entitycache, so that is not an issue.
Let's be pragmatic.
The update is for sure found properly.
Comment #40
tstoecklerI'm pretty sure this is a bug with Entity API, not with Profile2. @tim.plunkett's quote in #30 is correct, but incomplete:
Profile2 does not set EntityCacheDefaultEntityController as its class, it sets EntityAPIController provided by Entity API. The latter does manual calls into the controller helper class provided by entitycache, in order to provide automated Entity cache support for entity types (see #1111120: Support for EntityCache). So if Entity API claims to support Entity cache it seems it should also create the tables itself.
Not moving over to Entity module yet, because I would like some feedback on that position, but I fail to see what Profile2 is doing wrong.
Comment #41
tstoecklerHere's a patch against Entity API. I must admit that I didn't try it out myself. This does not yet contain an update function either, so people on existing sites won't be helped by this patch.
If you agree with my assessment we could move the issue to Entity API
Comment #42
tstoecklerOops.
Comment #44
tstoecklerOops, sorry. I didn't realize Profile2 had testing enabled. The patch is against Entity API 7.x-1.x.
Comment #45
Renee S commentedI think this should go to Entity instead. Worth a shot.
Comment #46
phizes commentedClosed #1874274: unable to edit (update) the profile (EntityCache problem) as a duplicate.
I have a sandbox project which I am using as a workaround for this issue on a couple of sites at the moment. It merely contains the schema for the missing cache table.
Comment #47
tstoecklerCreated #2017685: Automatically create cache tables for entities that want to support entitycache.module in the Entity API queue.
Comment #48
raulmuroc commentedSome light on this? Last patch does not work and even does not past the Drupal test.
Critical because if used when Profile2 modules enabled, it breaks the page completely.
Comment #49
deggertsen commentedI am using the sandbox project mentioned in #46 for the time being and it is working fine. Can't wait until #2017685: Automatically create cache tables for entities that want to support entitycache.module is fixed, but I don't really have the know-how to help much there.
Comment #50
tstoecklerFor anyone having this issue: The patch in #30 works fine. Note that you need to run update.php after applying it.
Comment #51
Grayside commented#30 works for me.
Comment #52
raulmuroc commentedAbout patch in #30:
- Many people confirm it works.
- It passed drupal's test.
Changing status.
Comment #53
jhedstromAgree with #52, RTBC.
Comment #54
dasjoplease have a look at our generic approach: #2017685-4: Automatically create cache tables for entities that want to support entitycache.module
i guess this might lead to a won't fix for the profile2 patch
Comment #55
fagoWe should create the table only when needed i.e. entitycache module is there. #2017685: Automatically create cache tables for entities that want to support entitycache.module takes care of that - so let's make use of that functionality once landed. Please help testing the patch over there to move on with this faster.
Comment #56
raulmuroc commentedI prepared a development environment cloned from the latest having problemas and applied patch in the other issue. Works fine for me.
I'm moving on the other issue. Perhaps this issue could be marked as duplicate and we could just attach the patch of #30 to the other issue (for the case).
Comment #57
tobiasbNow that we have a fix in #2017685: Automatically create cache tables for entities that want to support entitycache.module, we could close the issue or not?
Comment #58
geek-merlinYes this is fixed for me with current entity-7.x-1.5
:-)))
Comment #60
nattyweb commentedJust to say this is still valid: patch #30 required for me with drupal 7.32 and both latest dev versions of profile2 (7.x-1.3+6-dev) and entity api (7.x-1.5+7-dev).
Thanks to all for providing and advising!
Comment #61
spleshka@maranjo, can you please provide a steps to reproduce this issue? If it is still valid, then we definately have to tix this.
Comment #62
nattyweb commented@spleshka I can't really say what the steps were. I simply have profile2 installed as mentioned, and I saw the error shown at the start of this post whenever I try to run update.php (for any reason). I also saw the error when I tried to delete a user account using a vbo action, such that the account wouldn't delete.
This is on a pretty complex D7 website, so my guess it arose as a result of some sequence of installing modules over a period of months. I couldn't understand why the table cache_entity_profile2 was missing, but applying that patch (#30) did the trick and so I don't need to worry about it now.
Comment #63
spleshkaAs far as I see, this patch wasn't commited to profile2, that's why it fixed problem for you after you applied it. But I still can't explain why entity_cache module doesn't create a table for profile2 automatically.